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
210 stars 58 forks source link

iOS,zoom doesn't work when using RtcRemoteView.SurfaceView #32

Closed jeason789 closed 2 years ago

jeason789 commented 2 years ago

when i pinch, i found gestureState.numberActiveTouches is 1 in _handlePanResponderMove function

jeason789 commented 2 years ago

this.gestureHandlers = PanResponder.create({ onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder, onPanResponderGrant: this._handlePanResponderGrant, onPanResponderMove: this._handlePanResponderMove, onPanResponderRelease: this._handlePanResponderEnd, onPanResponderTerminate: (evt, gestureState) => { // We should also call _handlePanResponderEnd // to properly perform cleanups when the gesture is terminated // (aka gesture handling responsibility is taken over by another component). // This also fixes a weird issue where // on real device, sometimes onPanResponderRelease is not called when you lift 2 fingers up, // but onPanResponderTerminate is called instead for no apparent reason. this._handlePanResponderEnd(evt, gestureState); this.props.onPanResponderTerminate?.( evt, gestureState, this._getZoomableViewEventObject() ); }, onPanResponderTerminationRequest: (evt, gestureState) => !!this.props.onPanResponderTerminationRequest?.( evt, gestureState, this._getZoomableViewEventObject() ), onShouldBlockNativeResponder: () => true, });

this fixed my problem

web-copilot commented 5 months ago

Hi @jeason789 I am still experiencing this issue even after replacing the code with the provided snippet. Do you have any idea why this might be happening? version : "@openspacelabs/react-native-zoomable-view": "2.1.6",

when i pinch, i found gestureState.numberActiveTouches is 1 in _handlePanResponderMove function, as a result of which, gesture that is being picked is shift and not pinch and hence pinch to zoom doesn't work for this case