openspacelabs / react-native-zoomable-view

A view component for react-native with pinch to zoom, tap to move and double tap to zoom capability.
MIT License
191 stars 58 forks source link

How to keep to new position of the zoomable view after the pan movement ends? #30

Closed medmo7 closed 2 years ago

medmo7 commented 2 years ago

Thank you for this great library. I have a question, i would like to be able to drag an image and keep the new positon of the image (inside the boundaries) here is how I use the component:


    <ReactNativeZoomableView
        ref={zoomableRef}
        maxZoom={1}
            minZoom={0.3}
        zoomStep={0.1}
        initialZoom={1}
        bindToBorders={true}>                   
    <Image source={{ uri: currentQuestion.question_image }} resizeMode='contain' style={{ height: '100%', width: '100%' }} />
       </ReactNativeZoomableView>
thomasttvo commented 2 years ago

@medmo7 You'll need to use these props

contentWidth={number}
contentHeight={number}

For more details, you can refer to this example https://github.com/openspacelabs/react-native-zoomable-view#example