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

Pinch gesture not working #41

Closed jpmazza closed 3 years ago

jpmazza commented 4 years ago

I have a Twilio integration I want to let the user zoom in/out in the remote camera view.

<ReactNativeZoomableView
  maxZoom={3}
  minZoom={0.5}
  zoomStep={0.3}
  initialZoom={1}
  captureEvent
>
  <TwilioVideoParticipantView
    style={styles.remoteVideo}
    key={trackSid}
    trackIdentifier={trackIdentifier}
  />
</ReactNativeZoomableView>

Double-tap is working properly but the pinch gesture is not working for me. :/

"react-native": "~0.61.4"
"@dudigital/react-native-zoomable-view": "^1.0.15"
johhansantana commented 4 years ago

same here I think it has to do somewhere in this line the condition there is returning undefined always.

edit nvm, it has nothing to do with that line 😓 but from all the functions there it's the only one that I see its being called when trying to pinch

laraferroni commented 4 years ago

I ran into this as well, and determined it was because I was using it in a modal (specifically, the react-native-base Overlay). When I switched to an absolute positioned view instead, the pinch gesture worked. This appears to be an issue with the react-native-gesture-handler in modals.

If you add captureEvent={true} to your ReactNativeZoomableView, it looks like that fixes it.

michaelVictoriaDev commented 4 years ago

captureEvent={true} is having more warning error logs,

ph-sw commented 4 years ago

captureEvent={true} makes it work in Modal for me also. However, the zoom in and panning is not bound by the border of the view encapsulating the ReachNativeZoomableView component.

SimonErich commented 3 years ago

@laraferroni thanks for helping out here, I really appreciate it :) @ph-sw can you give a bit more information about the problem? It's important, that ReactNativeZoomableView covers the whole area, that you want to be "gesturable" otherwise we cannot listen to it.

SimonErich commented 3 years ago

Closed because no reply was given.