Repository navigation
android: Let a pull to refresh around a sideways scroll view take the drag - #4215
Merged
Merged
Conversation
… drag A sideways scroll view (a row of cards) claims each touch on its down and hands a drag it has no content for to the views around only when one of them takes it: its own pull to refresh, a pan around it, or a scroll view around it that can still move that way. A refreshing list at its top cannot scroll up, so a downward drag that starts on the row stayed with the row and the list never refreshed. A scroll view around that would start its pull now also takes the downward drag, as its own onInterceptTouchEvent decides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
huacnlee
approved these changes
Dec 3, 2026
huacnlee
left a comment
Member
There was a problem hiding this comment.
✅ Bounded Android fix: a downward drag that starts on a sideways row now lets the refreshing list around it pull.
- Defect: in a refreshing
Scroll, a downward drag starting inside a horizontal childScrollwas kept by the child, so pull to refresh never started. crates/nsh-platform-android/java/com/longbridge/nsh/ScrollBox.java(aroundPans): for a mostly vertical downward drag it yields when an ancestorScrollBoxtakesPull().takesPull()(not refreshing andcanPull()at top) is reused inonInterceptTouchEvent, so behaviour there is unchanged.- Tests:
examples/gallery/tests/refresh-around-row.test.tsxcovers the downward drag (refreshes, row stays) and the sideways drag (row scrolls, no refresh); Android only. - Public API: none.
- CI: not run (fork workflows are waiting for maintainer approval).
Reviewed at eb6cb50 (diff only, not built).
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.
Description
On Android, a vertical
Scroll/ListwithonRefreshcannot be pulled to refresh when the downward drag starts on a horizontal scroll view inside it (a row of cards, a horizontalList, a carousel). Starting the same drag anywhere else refreshes.Cause. The inner horizontal
ScrollBoxclaims the touch on its down (claimasks the views around not to intercept). Past the slop it hands a drag it has no content for to the views around only whenaroundTakessays one of them takes it: its own pull (canPull, always false for a horizontal view), aBoxpan around it, or an ancestor that can still scroll that way. A refreshing list at its top cannot scroll up (canScrollVertically(-1)is false), so nothing took the drag, the row kept it, and the outeronInterceptTouchEventthat starts the pull never saw it.Fix.
aroundPansalso counts aScrollBoxaround that would start its pull now (takesPull: not refreshing andcanPull, the same condition as itsonInterceptTouchEvent, which now uses it too). The inner view then lets go, and the outer list'sonInterceptTouchEventstarts the pull on the next move from thestartYit recorded on the down. Sideways drags and drags up are unchanged. iOS is not affected: UIKit already gives the pull to the outer scroll view.Screenshot
No visual change; the behavior is covered by the native test below.
How to Test
New test
examples/gallery/tests/refresh-around-row.test.tsx(fixturerefresh-around-row.tsx, a refreshing page with a horizontal row of cards), on an arm64 Android emulator:./target/debug/nsh test examples/gallery/tests/refresh-around-row.test.tsx --target androida downward drag on a sideways row pulls the page around it to refreshfails (refreshes: 0).Related nested-scroll tests on the same emulator, with the fix:
zoom-in-pager,pan-over-scrollandsheet-scrollpass. Inpan-around-scroll,a mostly sideways diagonal ... pans the viewfails on this emulator with and without this change (the fixture has no pull to refresh, so it does not reach the new branch).Not clean on
mainwith rustc 1.98.1, unrelated to this change:cargo xtask clippy-androidreportsthread_localconst-initializer lints innsh-core, andnsh check examples/galleryreports a type error intests/sheet-alert.test.tsx.Checklist
cargo test --workspace,cargo +nightly fmt --alland clippy (including the Catalyst and Android runs for platform code). (Java only; the Android clippy run fails onmainas noted above.)examples/gallerydemos on iOS and Android (if the change is visible or platform-specific). (Android, via the native tests above.)🤖 Generated with Claude Code