-
Notifications
You must be signed in to change notification settings - Fork 427
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(android): prevent taps while scrolling #961
Open
gpp-0
wants to merge
2
commits into
callstack:master
Choose a base branch
from
gpp-0:swipe-tap
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
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
Verified this fixes the issue in our app. |
gaearon
reviewed
Jan 17, 2025
gaearon
added a commit
to bluesky-social/social-app
that referenced
this pull request
Jan 17, 2025
* [Android] Fix taps triggering while swiping * Revert "[Android] Try to disambiguate taps from swipes (#7448)" This reverts commit 96054f4. * Update patch to match callstack/react-native-pager-view#961 * Make it symmetrical --------- Co-authored-by: Dan Abramov <[email protected]>
Hello 👋 Once it is rebased, we will merge it Thank you for your cooperation 🙏 |
troZee
approved these changes
Jan 17, 2025
MrRefactor
approved these changes
Jan 17, 2025
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.
Looks good to me!
brings this more in line with existing react patterns copied from bluesky-social/social-app@88b1878
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.
Summary
This PR fixes a bug on Android where taps sometimes incorrectly trigger while swiping between pager screens, see issues #960 and #954. These issues in turn were opened in order to investigate bluesky-social/social-app#7312
The cause of the bug seems to have had to do with React not being notified when the native pager starts scrolling, which meant that it didn't properly cancel gestures in the pager's children.
The fix involves adding a call to notifyNativeGestureStarted, whose purpose is exactly to notify JS that a native gesture has started so it can dispatch the appropriate cancel events, see its use in other similar components like ReactScrollView
This call was added to NestedScrollableHost, where scrolling canceling logic was already present, however the behavior of nested scrollables should hopefully remain unchanged.
Test Plan
I have tested the issues this PR aims to solve (#960, #954, bluesky-social/social-app#7312) and I cannot reproduce the described bugs anymore.
I have also tested all the examples in the repo, and all seem to function as expected. In particular, examples with scrollables (eg. ScrollViewInsideExample) or nested pagers (eg. NestPagerView) seem to be unaffected.
Compatibility
Checklist
README.md