WEB/NATIVE inconsistent behaviour of pan gesture callbacks with manual activation.
pedrogarciyalopez opened this issue · 1 comments
pedrogarciyalopez commented
Description
In the onTouchesDown
callback, stateManager.fail()
is called. It works as expected in native, but in the web, callbacks onTouchesMove
, onTouchesUp
etc continue to trigger, which should not happen.
Run the code below, swipe your finger across the screen, and watch the console.
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>
)
}
In the web, you will see the following output:
onTouchesDown, fail
onBegin
onTouchesMove
onTouchesUp
onFinalize
In the native, you will see the following output:
onBegin
onTouchesCancelled
onFinalize
onTouchesDown, fail
It seems like this is an issue that hasn't been fully resolved #2869.
@m-bert what do you think?
Steps to reproduce
try it on Snack
Snack or a link to a repository
https://snack.expo.dev/DPDgCkZ0hbai5s51p3AcM
Gesture Handler version
2.16.2
React Native version
0.71.9
Platforms
Android, iOS, Web
JavaScript runtime
None
Workflow
None
Architecture
None
Build type
None
Device
None
Device model
No response
Acknowledgements
Yes
m-bert commented
Hi @pedrogarciyalopez! I've just created this PR, could you please check if it helps?