State.BEGAN is skipped for LongPressGestureHandler on iOS
See original GitHub issueWhen using any of the gesture handlers, I normally expect to see the state flow go UNDETERMINED (0) -> BEGAN (2) -> ACTIVE (4) -> END (5). When using a LongPressGestureHandler in iOS though, I’m seeing it go UNDETERMINED (0) -> ACTIVE (4) -> END (5). In Android it behaves as expected.
I am using the iPhone 11 simulator running iOS 13.2.2 and the Android emulator running Pixel 2 API 28. I’m using RN 0.61.4 and RNGH 1.5.1 with an App function component that looks like this (TSX):
const App = () => {
return (
<>
<StatusBar barStyle="dark-content" />
<SafeAreaView style={{ flex: 1 }}>
<LongPressGestureHandler
onHandlerStateChange={(event: LongPressGestureHandlerStateChangeEvent) => {
console.log(`LongPress state change ${event.nativeEvent.oldState} -> ${event.nativeEvent.state}`);
}}
>
<View style={{ width: 200, height: 100, backgroundColor: 'blue' }}>
<Text>LongPress</Text>
</View>
</LongPressGestureHandler>
<PanGestureHandler
onHandlerStateChange={(event: PanGestureHandlerStateChangeEvent) => {
console.log(`Pan state change ${event.nativeEvent.oldState} -> ${event.nativeEvent.state}`);
}}
>
<View style={{ width: 200, height: 100, backgroundColor: 'green' }}>
<Text>Pan</Text>
</View>
</PanGestureHandler>
</SafeAreaView>
</>
);
}
When testing on iOS, the Pan behaves as expected but not the LongPress:
LOG LongPress state change 0 -> 4
LOG LongPress state change 4 -> 5
LOG LongPress state change 0 -> 4
LOG LongPress state change 4 -> 5
LOG Pan state change 0 -> 2
LOG Pan state change 2 -> 4
LOG Pan state change 4 -> 5
When testing on Android, both behave as expected:
LOG LongPress state change 0 -> 2
LOG LongPress state change 2 -> 4
LOG LongPress state change 4 -> 5
LOG Pan state change 0 -> 2
LOG Pan state change 2 -> 4
LOG Pan state change 4 -> 5
Additionally, because the LongPress never “begins” on iOS, we never see failed presses either. Here’s an example of a too-short press on Android going from UNDETERMINED (0) -> BEGAN (2) -> FAILED (1):
LOG LongPress state change 0 -> 2
LOG LongPress state change 2 -> 1
This relates tangentially to some existing issues, although most of those seem to be about the timing of when the state changes occur on the different platforms. In the case above, a specific state is being omitted entirely.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:6
- Comments:5 (1 by maintainers)

Top Related StackOverflow Question
Should be fixed in https://github.com/software-mansion/react-native-gesture-handler/pull/1610.
Having the same issue. Seems like its on purpose though. For me the event isn’t even being fired on iOS… https://github.com/software-mansion/react-native-gesture-handler/issues/1091
https://github.com/software-mansion/react-native-gesture-handler/blob/f9fe5d82c47da8b1370eaa8b1e3a00a0c31400c5/ios/Handlers/RNLongPressHandler.m#L71-L81