Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.

If the InitialOffset prop is set, the zoomableView "jumps" on the first pan... #89

Open
AVGHz opened this issue Oct 12, 2021 · 0 comments

Comments

@AVGHz
Copy link

AVGHz commented Oct 12, 2021

As we had to render some pictures with different initial offsets for our project, we noticed that on the first pan the pictures are being repositioned to 0,0;
Our solution was to initialise the lastX and lastY to the props on mount; we patched the module locally for our project;
Maybe this will help somebody;

we inserted this in line 85 of ReactNativeZoomableView.tsx, just before componentDidUpdate

componentDidMount() {
    if(typeof(this.props.initialOffsetX)!=='undefined') {
        this.setState({
            lastX: this.props.initialOffsetX
        })
    }
    if(typeof(this.props.initialOffsetY)!=='undefined') {
        this.setState({
            lastY: this.props.initialOffsetY
        })
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant