You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Android] Stop nested scroll when the root starts intercepting - #4592
When a gesture activates during a pull-to-refresh on an RN FlatList with an RN RefreshControl, the spinner parks half-pulled and onRefresh fires only on the next touch. Reported with ReanimatedSwipeable rows in #4563.
RN drives the pull through nested scrolling and SwipeRefreshLayout finishes it only in onStopNestedScroll, which Android triggers from View.dispatchTouchEvent by calling stopNestedScroll() after the final UP or CANCEL. When the root view starts intercepting, cancelTouchesInInterceptedViews feeds ACTION_CANCEL straight to onTouchEvent, so that cleanup never runs. Same omission #4492 fixed on the NativeViewGestureHandler path.
The sweep now calls stopNestedScroll() after onTouchEvent, as View.dispatchTouchEvent does. It is a no-op without an open nested scroll. An interrupted pull now snaps back, or fires onRefresh if it was past the threshold.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
📝 Summary
Summary by CodeRabbit
Bug Fixes
Nested scrolling now stops when an intercepted view receives a touch cancellation, except for views that continue handling native gestures.
The Android gesture handler now stops nested scrolling on eligible intercepted views after sending them ACTION_CANCEL.
Changes: Android touch cancellation
Layer / File(s)
Summary
Stop nested scrolling after cancellation packages/react-native-gesture-handler/android/src/main/java/com/swmansion/gesturehandler/core/GestureHandlerOrchestrator.kt
After sending ACTION_CANCEL, the method calls stopNestedScroll() on each intercepted view, except for the wrapper view and views driven by native gestures that survive arbitration.
Suggested reviewers:j-piasecki
Priority: ➖ Normal
Merge Risk:⚪ Minimal · up to 2989d
The change adds cleanup for interrupted Android nested scrolling, and the supplied evidence identifies no remaining concrete merge risk.
Pre-merge checks: 3
Passed checks (3 passed)
Check name
Status
Explanation
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Title check
The title clearly and concisely describes the main Android change: stopping nested scrolling when the root view starts intercepting touches.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
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
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
When a gesture activates during a pull-to-refresh on an RN
FlatListwith an RNRefreshControl, the spinner parks half-pulled andonRefreshfires only on the next touch. Reported withReanimatedSwipeablerows in #4563.RN drives the pull through nested scrolling and
SwipeRefreshLayoutfinishes it only inonStopNestedScroll, which Android triggers fromView.dispatchTouchEventby callingstopNestedScroll()after the final UP or CANCEL. When the root view starts intercepting,cancelTouchesInInterceptedViewsfeedsACTION_CANCELstraight toonTouchEvent, so that cleanup never runs. Same omission #4492 fixed on theNativeViewGestureHandlerpath.The sweep now calls
stopNestedScroll()afteronTouchEvent, asView.dispatchTouchEventdoes. It is a no-op without an open nested scroll. An interrupted pull now snaps back, or firesonRefreshif it was past the threshold.Test plan
FlatList+ RNRefreshControlwithReanimatedSwipeablerows and with bare v3 pan rows, drag a row down then sideways. Short pull snaps back and the row still swipes, long pull firesonRefreshimmediately. Previously the spinner parked until the next touch.FlatList+ RNRefreshControl, GHFlatList+ GHRefreshControl, plain pulls and plain row swipes unchanged. iOS unaffected.Repro
Details