Repository navigation
Fix horizontal ScrollView resting past its left edge after a fling on Android 14 - #59020
Open
YevheniiKotyrlo wants to merge 1 commit into
Open
YevheniiKotyrlo wants to merge 1 commit into
YevheniiKotyrlo wants to merge 1 commit into
Conversation
… Android 14 A horizontal ScrollView resting at its left edge, dragged further left and released while moving, came to rest 6 dp past that edge on Android 14. ReactHorizontalScrollView.fling() starts its own overscroll fling where the platform absorbs a fling into the edge effect the drag is still pulling, and Android 14's consumeFlingInStretch() feeds the spring-back into that stretch, so the view never moves back. Hand a fling into the left edge the view rests at to super.fling().
Contributor
Author
YevheniiKotyrlo
marked this pull request as ready for review
October 12, 2026 23:10
This branch has not been deployed
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:
On Android 14, a horizontal
ScrollViewresting at its left edge, dragged further left and released while moving, comes to rest 6 dp past that edge and stays there until it is touched again: the content shows a gap and the view reports a negative offset. In right-to-left layout the left edge is the reading end, so a list flung toward its end sticks the same way.ReactHorizontalScrollView.fling()always starts its own overscroll fling (minX = 0,overX = width / 2), where the platform'sHorizontalScrollView.fling()absorbs a fling into an edge effect that is still pulled.computeScroll()clamps the overscroll tomOverflingDistanceand springs back, but Android 14'sconsumeFlingInStretch()feeds every spring-back step into the stretch the drag is still pulling, so the scroller finishes at 0 and the view stays at −6 dp. Android 15 adds the guard that prevents it (if (scrollX < 0 || scrollX > getScrollRange()) return unconsumed;), and Android 13'sHorizontalScrollViewhas noconsumeFlingInStretch.This hands a fling that heads into the left edge the view rests at to
super.fling(), so the platform absorbs it into the edge effect as it does for a plainHorizontalScrollView. Every other fling keeps React Native's own path. The verticalScrollViewis not affected:ScrollView.onTouchEventreleases throughflingWithNestedDispatch, which absorbs a fling into an edge the view rests at and never callsfling().Changelog:
[ANDROID] [FIXED] - Fix horizontal ScrollView resting past its left edge after a fling on Android 14
Test Plan:
ReactHorizontalScrollViewFlingTest(Robolectric,sdk = 34) drags a horizontal ScrollView at its left edge further left and releases it. Onmainit rests atscrollX = -6(expected:<[0]> but was:<[-6]>); with this change at 0. A second case flings into the content, so the drag is shown to produce a real fling. Robolectric'sShadowEdgeEffectturns edge effects off on API 31+, so the test supplies a shadow that keeps the stretch a device uses../gradlew :packages:react-native:ReactAndroid:testDebugUnitTest: 707 tests pass.yarn format-check-kotlinandyarn format-check-javapass.Item 0rests 18 px right of where it sat without this change and where it sat with it — before/after.