Skip to content
This repository was archived by the owner on Nov 30, 2022. It is now read-only.
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

@AVGHz

Description

@AVGHz

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
        })
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions