-
-
Notifications
You must be signed in to change notification settings - Fork 1k
[iOS] Fix gestures not ending properly on iOS
26
#3740
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
#define RNGHGestureRecognizerStateBegan UIGestureRecognizerStateBegan; | ||
#define RNGHGestureRecognizerStateEnded UIGestureRecognizerStateEnded; | ||
|
||
#define iOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, since iOS_VERSION
macro returns float
, we may want to do comparisons up to a constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont't really see a case where this would be an issue. I know floats behave weirdly, but we will always be checking it via a \leq or \geq comparison with another float and and the mapping from real values to floats is monotonic - it keeps the ordering.
#define RNGHGestureRecognizerStateBegan UIGestureRecognizerStateBegan; | ||
#define RNGHGestureRecognizerStateEnded UIGestureRecognizerStateEnded; | ||
|
||
#define iOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont't really see a case where this would be an issue. I know floats behave weirdly, but we will always be checking it via a \leq or \geq comparison with another float and and the mapping from real values to floats is monotonic - it keeps the ordering.
packages/react-native-gesture-handler/apple/Handlers/RNLongPressHandler.m
Outdated
Show resolved
Hide resolved
I'll just mention that we might want to release this fix fast, in a release, as currently gh is broken on all iOS 26 devices. |
Description
There's a change in gesture recognizers introduced in
iOS
26. Now whenreset
method is called, recognizers go back toUIGestureRecognizerStatePossible
state. This breaks our current behavior, because this state is mapped intoRNGestureHandlerStateBegan
, so if for examplePan
fails, it tries to send event withBegan
state.Unfortunately, changing recognizer state is not possible outside of
touches*
methods, therefore we had to movetriggerAction
into those callbacks.Let me know if you see a different approach into this problem.
Fixes #3733
Warning
triggerAction
call was already present inTap
right beforereset
(see here). Looks like it was called twice for some reason (but I believe that check for _lastState prevented any problems with this redundancy). For now I have not included second call. If you think it is required, let me know.Test plan
Tested on the code provided below, on the following platforms:
Test code: