Skip to content

Conversation

Maxr1998
Copy link
Contributor

🌟 Description

I discovered a few bugs while debugging an issue in this library today. Please let me know if I should create separate PRs for these. All changes are mostly self-contained, but the commits touch similar parts of the code and thus partially depend on each other. I wrote descriptions for each issue inside the commit messages. Please don't hesitate to cherry-pick or modify this PR as you wish.

Hopefully, these changes can be upstreamed, since that would be better than continuing to maintain our fork.

This makes it consistent with the computeScrollVectorForPosition function.
While onStart is empty, onStop handles some cleanup in LinearSmoothScroller and should thus call the super function.
The unit returned by calculateSpeedPerPixel is ms/pixel, so to get a pixel distance one has to divide the target time by the "speed".
Otherwise, the layout manager would only layout the current view where item width = recycler width, which in turn can cause weird effects when smooth scrolling:
In a production app, we observed the smooth scroller shooting past the target which was the immediate next view, taking an extra round and looping back to the actual target.
Setting the extraLayoutSpace to 1 fixes this issue.
@Maxr1998 Maxr1998 changed the base branch from master to develop July 31, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant