-
-
Notifications
You must be signed in to change notification settings - Fork 984
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reset relevant handler when recognizer gets reset. (#2705)
## Description At the moment `reset` method is only called in `gestureRecognizerShouldBegin`: https://github.com/software-mansion/react-native-gesture-handler/blob/35ec17d636220c1ad4226456aa3b03c846ba16a8/apple/RNGestureHandler.m#L487 However, I've noticed that this method is called after some events are already sent, mainly the `BEGIN` event, which is often sent as soon as `onTouchesBegan` is executed for the first pointer. According to the [apple documentation](https://developer.apple.com/documentation/uikit/uigesturerecognizer/1620004-reset?language=objc), the `reset` method of recognizer is the place to reset the internal state of recognizer, which in this case in my opinion should also include the state of the handler. The issue this fixes is the one described in #2628: > One thing that could be related is the fact that when the gesture fails before activation, the gesture stays in the Began state until the finger is lifted. This still needs to be investigated. This was coming from the fact that the handler was failing before it was allowed to 'begin' (iOS begin not RNGH begin), so `gestureRecognizerShouldBegin` was not called, thus not resetting the failing handler. Because of that, it was sending events containing wrong states. ## Test plan Tested on the Example app.
- Loading branch information
1 parent
7c115be
commit 7581fde
Showing
10 changed files
with
16 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters