Repository navigation
fix(android): cancel the JS touch when the pager starts dragging - #1183
Merged
krozniata merged 1 commit intoOct 15, 2026
Merged
Conversation
Luccacvb
force-pushed
the
fix/android-cancel-touch-on-drag
branch
from
October 14, 2026 21:31
3092d90 to
7c94a5b
Compare
krozniata
previously approved these changes
Oct 15, 2026
troZee
previously approved these changes
Oct 15, 2026
Luccacvb
force-pushed
the
fix/android-cancel-touch-on-drag
branch
from
October 15, 2026 11:33
7c94a5b to
41eddcc
Compare
Contributor
Author
troZee
approved these changes
Oct 15, 2026
krozniata
approved these changes
Oct 15, 2026
This file contains hidden or 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
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
Fixes the Android case of #424, which reports this on Android and on iOS. Related: #960, #954.
In 9.x, on Android, a swipe that starts on a
Pressableinside a page never sendstouchcancelto JS. Every such swipe ends withtouchend, so thePressablecan fireonPresswhen thedraggingevent reaches JS late, for example while the JS thread is busy. This is #960 coming back in 9.x.reproduction
pager-view-before-after.mp4
What happened
NativeGestureUtil.notifyNativeGestureStartedfromNestedScrollableHost.onInterceptTouchEventonce the touch passed the slop (fix(android): prevent taps while scrolling #961), so React Native cancelled the JS touch, as it does forScrollView.NestedScrollableHost.kt, and the call was not ported toComposePagerView. Only the JS guard is left, and it depends on when thedraggingevent arrives.Fix
ComposePagerViewnotifies React Native fromonInterceptTouchEventwhen the touch movestouchSlopalong the pager axis, where the Compose pager starts dragging, and ends the native gesture onACTION_UP, likeReactScrollView.scrollEnabledisfalse.touchcancelinstead oftouchend, as in 8.x.dispatchTouchEventblock as fix(android): let nested horizontal ScrollView scroll inside pager #1182, so whichever lands second needs a small rebase. I can do it here.Test Plan
What's required for testing (prerequisites)?
Android emulator or device.
What are the steps to reproduce (after prerequisites)?
Added
Issue #424 Swipe Cancels Press Reproto the example app ande2e/tests/issues/issue-424-swipe-cancels-press.e2e.ts:Touch: end. After:Touch: cancel.Block JS, then do the same swipe. Before:Presses: 1, the swipe pressed the button. After:Presses: 0,Touch: cancel.Verified
format:check,lint(no new warnings),typecheck,prepare,test, exampletypescriptand e2etypecheckpass.Touch: cancel, and a swipe from it while JS is blocked leavesPresses: 0.PanResponderin a page: a horizontal drag on it gives the same callbacks on main and with the fix (grant, then terminate, and the page changes).iOS is untouched.
Compatibility
Checklist
README.md: not applicable