Fix ScrollView infinite scrolling bug by correcting pageUp/pageDown dimension usage #15173
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.
The ScrollView component was experiencing infinite scrolling behavior in React Native Windows 0.80 preview 6, as reported in the React Native Gallery app. The root cause was incorrect dimension usage in the
pageUp()
andpageDown()
functions for horizontal scrolling.Problem
When a ScrollView had the
horizontal
prop set to true, thepageUp()
andpageDown()
functions were incorrectly usingframe.size.height
instead offrame.size.width
to calculate the scroll delta. This caused:The bug was introduced in 0.80 preview 6 when custom scrollbar functionality was added. The
pageUp()
andpageDown()
functions were created with the dimensional bug and are triggered when users interact with the PageUp/PageDown regions of the custom scrollbars.Solution
Fixed the dimension calculation in two functions:
Now horizontal ScrollViews correctly use viewport width for page-based scrolling, while vertical ScrollViews continue to use viewport height as expected.
Impact
Fixes #15171.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.
Microsoft Reviewers: Open in CodeFlow