Skip to content

Commit e566b99

Browse files
authored
[ios] Force going through begin in state manager (#3979)
## Description The state manager was not functioning correctly on iOS because the state change from begin to activate did not go through begin. `handleStateChange` doesn't call `handleGesture` for activate directly as it bypasses gesture interaction system. Instead it relies on the activate gesture being called from reset. It worked previously, but after commit c6051ca introduced a direct check in `handleGesture` to determine whether it was invoked from reset. As a result, manually handled gestures were never activated. ## Test plan Tested on the StateManager example.
1 parent 495db78 commit e566b99

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

packages/react-native-gesture-handler/apple/RNGestureHandlerModule.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,10 @@ - (void)setGestureStateSync:(int)state forHandler:(int)handlerTag
225225
} else if (state == 3) { // CANCELLED
226226
handler.recognizer.state = RNGHGestureRecognizerStateCancelled;
227227
} else if (state == 4) { // ACTIVE
228+
if (handler.recognizer.state == UIGestureRecognizerStatePossible) {
229+
// Force going from UNDETERMINED to ACTIVE through BEGAN to preserve the correct state transition flow.
230+
[handler handleGesture:handler.recognizer fromReset:NO];
231+
}
228232
[handler stopActivationBlocker];
229233
handler.recognizer.state = RNGHGestureRecognizerStateBegan;
230234
} else if (state == 5) { // ENDED

0 commit comments

Comments
 (0)