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

onShouldBlockNativeResponder #71

Closed lukahc closed 9 months ago

lukahc commented 10 months ago

Currently the zoomable view conflicts with other packages like react native tab view because of line 130 in src/ReactNativeZoomableView.tsx:

onShouldBlockNativeResponder: () => false,

This line can lead to the PanResponder being terminated if there are other instances of PanResponder, meaning that the zoomable view can't pan or zoom properly, if at all. Could you please fix this, either by changing false to true, or just by making onShouldBlockNativeResponder an optional prop?

elliottkember commented 9 months ago

Hi! This sounds like a great candidate for a pull request. If you are able to fix the problem in a PR, please submit it and we'll take a look.

elliottkember commented 9 months ago

@lukahc Thank you for the help! Turns out I needed this functionality almost immediately. Very useful.

Do you think this should be true by default? It seems like it would always be a good idea for it to block pan responders.

lukahc commented 9 months ago

@lukahc Thank you for the help! Turns out I needed this functionality almost immediately. Very useful.

Do you think this should be true by default? It seems like it would always be a good idea for it to block pan responders.

I agree, I can't think of many scenarios where it would be better for it to be false, I can make a PR for that change

lukahc commented 9 months ago

@elliottkember https://github.com/openspacelabs/react-native-zoomable-view/pull/75

elliottkember commented 9 months ago

Nice – I think that should be fine.

An interesting note: onShouldBlockPanResponder is only implemented on Android.

However, I found that it was working on iOS too, but only because I happened to be using a react-native-gesture-handler wrapper. That library overrides UIManager to make this work. More info here: https://github.com/facebook/react-native/pull/40750