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

'onStartShouldSetPanResponder' ignores return value #43

Open michaelfaisst opened 2 years ago

michaelfaisst commented 2 years ago

Hey guys,

first of all, thanks for the awesome work!

I've been using your view with a drawing component inside, to be able to draw over an image. The drawing itself can be toggled on and off, so the logic I wanted to implement is, that if drawing is enabled, zooming/pinching should be disabled, and vice versa.

To solve this, I tried using the onStartShouldSetPanResponder hook and returned false in it whenever drawing is enabled, but noticed that this doesn't work because in your implementation here you ignore the return value and just always return true. Is there any reason why this is done this way? I've made a fork with the change, and it seems to work normally.

Also tried implementing it with onShiftingBefore, but when doing that I still get a little pinch animation at the end of the gesture.

PS: Maybe this could also be solved with the suggestion in #38, to have some kind of prop to disable pinching.

Cheers, Michael