-
-
Notifications
You must be signed in to change notification settings - Fork 984
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
Fix double start when activateAfterLongPress
is used
#2628
Merged
Merged
Conversation
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
currently facing this issues, is there a workaround for this? |
m-bert
approved these changes
Dec 21, 2023
Co-authored-by: Michał Bert <[email protected]>
j-piasecki
added a commit
that referenced
this pull request
Jan 10, 2024
## 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.
renovate bot
referenced
this pull request
in valora-inc/wallet
Feb 17, 2024
…4933) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-native-gesture-handler](https://togithub.com/software-mansion/react-native-gesture-handler) | [`^2.14.1` -> `^2.15.0`](https://renovatebot.com/diffs/npm/react-native-gesture-handler/2.14.1/2.15.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-gesture-handler/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-gesture-handler/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-gesture-handler/2.14.1/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-gesture-handler/2.14.1/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>software-mansion/react-native-gesture-handler (react-native-gesture-handler)</summary> ### [`v2.15.0`](https://togithub.com/software-mansion/react-native-gesture-handler/releases/tag/2.15.0) [Compare Source](https://togithub.com/software-mansion/react-native-gesture-handler/compare/2.14.1...2.15.0) #### ❗ Important changes - macOS Support by [@​HeroBanana](https://togithub.com/HeroBanana) and [@​jfedak](https://togithub.com/jfedak) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2588](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2588) - feat: add visionOS support by [@​tomekzaw](https://togithub.com/tomekzaw) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2743](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2743) - Add `mouseButton` prop by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2676](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2676) - Migrate Gesture Handler to TurboModule by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2354](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2354) #### 🐛 Bug fixes - Add checks for the same instance of handler usage across multiple `GestureDetectors` by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2694](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2694) - Remove `didMountComponentsWithRootTag` on the new arch by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2687](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2687) - Fix double start when `activateAfterLongPress` is used by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2628](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2628) - Reset relevant handler when recognizer gets reset. by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2705](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2705) - Fix `inactive` handlers staying at finished state by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2738](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2738) - Change functions in windows module file to no-ops. by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2741](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2741) - Fix handlers coming back from being cancelled by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2704](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2704) - fix: restore ReactMethod annotation by [@​WoLewicki](https://togithub.com/WoLewicki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2722](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2722) #### 🔢 Miscellaneous - Bump react-devtools-core from 4.27.6 to 4.28.4 in /example by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2650](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2650) - Add `workflow_dispatch` to workflows by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2295](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2295) - Update supported versions in readme and in docs by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2684](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2684) - Prevent GH actions trigger on forks, update template by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2696](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2696) - Auto add `Platform: MacOS` label when `MacOS` is picked in the issue by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2699](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2699) - Change eslint `ban-types` to warning. by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2714](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2714) - Fix macOS warning message by [@​jfedak](https://togithub.com/jfedak) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2713](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2713) - Bump dependencies to stable React Native 0.73.2 by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2698](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2698) - Add macOS app icon by [@​jfedak](https://togithub.com/jfedak) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2723](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2723) - Bump follow-redirects from 1.15.3 to 1.15.4 in /e2e/web-tests by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2719](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2719) #### New Contributors - [@​mrousavy](https://togithub.com/mrousavy) made their first contribution in [https://github.com/software-mansion/react-native-gesture-handler/pull/2690](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2690) - [@​HeroBanana](https://togithub.com/HeroBanana) made their first contribution in [https://github.com/software-mansion/react-native-gesture-handler/pull/2588](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2588) - [@​fxamauri](https://togithub.com/fxamauri) made their first contribution in [https://github.com/software-mansion/react-native-gesture-handler/pull/2712](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2712) - [@​jfedak](https://togithub.com/jfedak) made their first contribution in [https://github.com/software-mansion/react-native-gesture-handler/pull/2713](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2713) - [@​computerjazz](https://togithub.com/computerjazz) made their first contribution in [https://github.com/software-mansion/react-native-gesture-handler/pull/2715](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2715) **Full Changelog**: software-mansion/react-native-gesture-handler@2.14.0...2.15.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone America/Los_Angeles. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/valora-inc/wallet). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: valora-bot <[email protected]>
shottah
referenced
this pull request
in zed-io/kolektivo
May 15, 2024
…alora-inc#4933) [![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [react-native-gesture-handler](https://togithub.com/software-mansion/react-native-gesture-handler) | [`^2.14.1` -> `^2.15.0`](https://renovatebot.com/diffs/npm/react-native-gesture-handler/2.14.1/2.15.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-gesture-handler/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-gesture-handler/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-gesture-handler/2.14.1/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-gesture-handler/2.14.1/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | --- ### Release Notes <details> <summary>software-mansion/react-native-gesture-handler (react-native-gesture-handler)</summary> ### [`v2.15.0`](https://togithub.com/software-mansion/react-native-gesture-handler/releases/tag/2.15.0) [Compare Source](https://togithub.com/software-mansion/react-native-gesture-handler/compare/2.14.1...2.15.0) #### ❗ Important changes - macOS Support by [@​HeroBanana](https://togithub.com/HeroBanana) and [@​jfedak](https://togithub.com/jfedak) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2588](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2588) - feat: add visionOS support by [@​tomekzaw](https://togithub.com/tomekzaw) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2743](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2743) - Add `mouseButton` prop by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2676](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2676) - Migrate Gesture Handler to TurboModule by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2354](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2354) #### 🐛 Bug fixes - Add checks for the same instance of handler usage across multiple `GestureDetectors` by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2694](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2694) - Remove `didMountComponentsWithRootTag` on the new arch by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2687](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2687) - Fix double start when `activateAfterLongPress` is used by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2628](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2628) - Reset relevant handler when recognizer gets reset. by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2705](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2705) - Fix `inactive` handlers staying at finished state by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2738](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2738) - Change functions in windows module file to no-ops. by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2741](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2741) - Fix handlers coming back from being cancelled by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2704](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2704) - fix: restore ReactMethod annotation by [@​WoLewicki](https://togithub.com/WoLewicki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2722](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2722) #### 🔢 Miscellaneous - Bump react-devtools-core from 4.27.6 to 4.28.4 in /example by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2650](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2650) - Add `workflow_dispatch` to workflows by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2295](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2295) - Update supported versions in readme and in docs by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2684](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2684) - Prevent GH actions trigger on forks, update template by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2696](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2696) - Auto add `Platform: MacOS` label when `MacOS` is picked in the issue by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2699](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2699) - Change eslint `ban-types` to warning. by [@​m-bert](https://togithub.com/m-bert) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2714](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2714) - Fix macOS warning message by [@​jfedak](https://togithub.com/jfedak) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2713](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2713) - Bump dependencies to stable React Native 0.73.2 by [@​j-piasecki](https://togithub.com/j-piasecki) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2698](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2698) - Add macOS app icon by [@​jfedak](https://togithub.com/jfedak) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2723](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2723) - Bump follow-redirects from 1.15.3 to 1.15.4 in /e2e/web-tests by [@​dependabot](https://togithub.com/dependabot) in [https://github.com/software-mansion/react-native-gesture-handler/pull/2719](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2719) #### New Contributors - [@​mrousavy](https://togithub.com/mrousavy) made their first contribution in [https://github.com/software-mansion/react-native-gesture-handler/pull/2690](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2690) - [@​HeroBanana](https://togithub.com/HeroBanana) made their first contribution in [https://github.com/software-mansion/react-native-gesture-handler/pull/2588](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2588) - [@​fxamauri](https://togithub.com/fxamauri) made their first contribution in [https://github.com/software-mansion/react-native-gesture-handler/pull/2712](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2712) - [@​jfedak](https://togithub.com/jfedak) made their first contribution in [https://github.com/software-mansion/react-native-gesture-handler/pull/2713](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2713) - [@​computerjazz](https://togithub.com/computerjazz) made their first contribution in [https://github.com/software-mansion/react-native-gesture-handler/pull/2715](https://togithub.com/software-mansion/react-native-gesture-handler/pull/2715) **Full Changelog**: software-mansion/react-native-gesture-handler@2.14.0...2.15.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone America/Los_Angeles. 🚦 **Automerge**: Enabled. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/valora-inc/wallet). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9--> --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: valora-bot <[email protected]>
This was referenced May 21, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
It seems like native iOS recognizers (or at least Pan) don't respect when their state is changed from outside, which caused a problem with
.activateAfterLongPress
- before sending event inActive
state, the state of the native recognizer is updated toUIGestureRecognizerStateBegan
. Despite this, after moving the finger it tries to change the state toUIGestureRecognizerStateBegan
once more, causing weirdActive
->Began
,Began
->Active
chain.This PR adds a simple check to detect the first event and stop processing in case it happens.
One thing that could be related is the fact that when the gesture fails before activation, the gesture stays in theI think this is a separate issue.Began
state until the finger is lifted. This still needs to be investigated.Fixes #2620
Test plan
Tested on the example app.