-
-
Notifications
You must be signed in to change notification settings - Fork 987
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Description As stated in #2907, web shows inconsistent behavior with native platforms when it comes to touch event callbacks. This PR unifies its behavior with `Android` by calling `sendTouchEvent` after handler goes to `BEGAN` state. Previously it wouldn't fail, because transition from `UNDETERMINED` into `FAIL` is not possible on web. Fixes #2907. ### `onBegin` and `onFinalize` We agreed with @j-piasecki that `onFinalize` should be called only when `onBegin` was called. However, in that specific case (i.e. snippet from issue) we are not sure if those callbacks should be triggered and it is still a thing for a discussion. ## Test plan <details> <summary> Tested on the following code from issue </summary> ```jsx import { View } from 'react-native'; import { Gesture, GestureDetector, GestureHandlerRootView } from 'react-native-gesture-handler'; export default function App() { const panGesture = Gesture.Pan() .manualActivation(true) .onTouchesDown((e, stateManager) => { stateManager.fail(); console.log('onTouchesDown, fail') }) .onTouchesUp(() => console.log('onTouchesUp')) .onTouchesMove(() => console.log('onTouchesMove')) .onBegin(() => console.log('onBegin')) .onChange(() => console.log('onChange')) .onTouchesCancelled(() => console.log('onTouchesCancelled')) .onFinalize(() => console.log('onFinalize')) .onStart(() => console.log('onStart')) .onUpdate(() => console.log('onUpdate')) .onEnd(() => console.log('onEnd')); return ( <GestureHandlerRootView style={{ flex: 1 }}> <GestureDetector gesture={panGesture}> <View style={{ flex: 1, backgroundColor: 'yellow' }} /> </GestureDetector> </GestureHandlerRootView> ) } ``` </details>
- Loading branch information
Showing
9 changed files
with
40 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters