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
205 stars 57 forks source link

zoomTo should allow to reach exactly the minZoom or maxZoom #17

Closed stopachka closed 2 years ago

stopachka commented 2 years ago

Hey team, right now, if we do the following:

In zoomTo(https://github.com/openspacelabs/react-native-zoomable-view/blob/master/src/ReactNativeZoomableView.tsx#L930),

The check to see if it's a valid zoom is

        newZoomLevel >= this.props.maxZoom ||
        newZoomLevel <= this.props.minZoom

But this would mean that it's not possible to "reset" to the minZoom:

<ReactNativeZoomableView minZoom={1} ref={zoomableRef}>...</ReactNativeZoomableView>
...
zoomableRef.current!.zoomTo(1) // fail

Should this check of < and >, instead of <= and >= ?

elliottkember commented 2 years ago

@stopachka Seems like it would work! Would you mind creating a pull request with this change?

thomasttvo commented 2 years ago

Should be fixed in #34