DuDigital / 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
241 stars 112 forks source link

Reset zoom level #50

Closed KarolisKaj closed 3 years ago

KarolisKaj commented 3 years ago

Hello,

Great job at creating this zoom component, really appreciate it.

I was wondering if there is a way to reset zoom level on any event. I.e. when zoom level reaches 0.2 I'd like put it back to 1. How can I achieve that?

/Karolis

SimonErich commented 3 years ago

@KarolisKaj sorry for the late reply. We have now implemented events, that allow you to just do that.

I would just track the zoomLevel and call the zoomTo method, if it exceeds a certain value.

Here are the details: https://github.com/DuDigital/react-native-zoomable-view/releases/tag/v1.1.0

Please make sure to install the latest version. (1.1.3 or up for a working version) You can also check out the example repo for an examples: https://github.com/DuDigital/react-native-zoomable-view