Skip to content

Conversation

@nohabean
Copy link

@nohabean nohabean commented Jun 4, 2025

Summary:

This PR fixes an issue in the fling behavior where OverScroller could cause overscroll due to an unbounded scroll range. The existing implementation used Integer.MAX_VALUE as the max scroll limit.

The proposed change calculates the actual scrollable range using computeVerticalScrollRange() and clamps the fling bounds based on the result. This prevents scrolling beyond content limits.

image

Changelog:

[ANDROID] [FIXED] - Prevents overscroll during fling by calculating and applying scrollable bounds based on the scrollable range.

Test Plan:

Manually tested fling behavior in a ScrollView with varying content lengths.
Verified that fling stops at the correct content boundary and does not scroll beyond the visible area.

@facebook-github-bot
Copy link
Contributor

Hi @nohabean!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 4, 2025
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@facebook-github-bot facebook-github-bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Jun 4, 2025
@NickGerleman
Copy link
Contributor

A couple of bits come to mind.

  1. We are allowed to overscrolll, at least sometimes. I think this is controlled via overScrollMode. This has a rubber banding effect
  2. We have the same logic in HorizontalScrollView

How are these bounds derived normally for a fling? Either by RN, or by Android ScrollView?

@react-native-bot
Copy link
Collaborator

This PR is stale because it has been open for 180 days with no activity. It will be closed in 7 days unless you comment on it or remove the "Stale" label.

@react-native-bot react-native-bot added Stale There has been a lack of activity on this issue and it may be closed soon. and removed Stale There has been a lack of activity on this issue and it may be closed soon. labels Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants