Skip to content

Commit 5a19877

Browse files
authored
fix: make stack navigator work with latest gesture handler (#10270)
With the release of Gesture Handler 2 some gesture handlers have been updated to follow state-flow more consistently across the platforms. Among them was the Pan gesture which was changed to transition to the `BEGAN` state as soon as finger touches the screen opposed to just before transitioning to the `ACTIVE` state. `@react-navigation/stack` is relying on the old behavior which may be causing some unexpected issues in apps, for example: software-mansion/react-native-gesture-handler#1801. This PR changes the swipe-back gesture to start when the Pan transitions to the`ACTIVE` state. Since previously Pan gesture was transitioning to the `BEGAN` state just before transitioning to the `ACTIVE` state this change would be compatible with older versions of Gesture Handler.
1 parent d0f8620 commit 5a19877

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/stack/src/views/Stack/Card.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ export default class Card extends React.Component<Props> {
272272
} = this.props;
273273

274274
switch (nativeEvent.state) {
275-
case GestureState.BEGAN:
275+
case GestureState.ACTIVE:
276276
this.isSwiping.setValue(TRUE);
277277
this.handleStartInteraction();
278278
onGestureBegin?.();

0 commit comments

Comments
 (0)