terrylinla / react-native-sketch-canvas

A React Native component for drawing by touching on both iOS and Android.
MIT License
695 stars 453 forks source link

Gesture Responder System events are never fired for SketchCanvas #181

Closed rrr3da closed 3 years ago

rrr3da commented 3 years ago

Hi @terrylinla and thank you for your great plugin!

Reading the gesture-responder-system docs here we should be able to attach to the responder system, but the callbacks are never getting called. I'm expecting this because SketchCanvas in the end implements GestureResponderHandlers interface, but I'm not able to make it work

I'm running the latest version of this lib (0.8.0) over RN 0.63.3. The problem exists for both iOS and Android platforms.

Try putting a SketchCanvas component alone with another sister view in a component. Responder system works well for the sister view, but not for the SketchCanvas.

<SketchCanvas ref={canvasEl}
  onStartShouldSetResponderCapture={(event: GestureResponderEvent) => { console.log('CANVAS onStartShouldSetResponderCapture'); }}
  onMoveShouldSetResponderCapture={(event: GestureResponderEvent) => { console.log('CANVAS onMoveShouldSetResponderCapture'); }}
  onStartShouldSetResponder={(event: GestureResponderEvent) => { console.log('CANVAS onStartShouldSetResponder'); }}
  onMoveShouldSetResponder={(event: GestureResponderEvent) => { console.log('CANVAS onMoveShouldSetResponder'); }}
  onResponderGrant={(event: GestureResponderEvent) => console.log('CANVAS was granted handling event')}
  onResponderReject={(event: GestureResponderEvent) => console.log('CANVAS was rejected handling event')}
  onResponderMove={(event: GestureResponderEvent) => console.log('CANVAS onResponderMove')}
  style={{ flex: 1 }}
  >
</SketchCanvas>
rrr3da commented 3 years ago

Closing because there's PR #75 that solves this. Please accept pull requests 💯

Regards