Skip to content

Conversation

@slvvn
Copy link
Contributor

@slvvn slvvn commented Sep 27, 2024

Hi, currently the VirtualizedList only supports having a scroll behavior of sticking to either sides of the list (start or end).
In our case we have a very centered UI, and we would like to have an option to have "centering" behavior of the focused item in the list.
This PR contains the addition of the stick-to-center scroll behavior, which at the first/last few items (depending on the item widths) will stay at the same position, and the moment it physically becomes possible to center the current item in the list it will do that.
Tried to have minimal impact to the codebase, and added some tests as well.
It works perfect in our case using a patch for now. Curious what you think about implementing this into the package too.

@pierpo
Copy link
Member

pierpo commented Oct 8, 2024

Hey! Thank you for the PR 😁 It looks awesome!
I will test it soon, and I'm pretty sure we'll be able to merge right away 😄

I still need to handle another important PR that brings a breaking change (simplifying the Virtualized Lists)!

@pierpo
Copy link
Member

pierpo commented Oct 15, 2024

Hey!

I tried the PR, but there were a few bugs:

  • the computed range was incorrect and was too narrow after a few scrolls
  • if there are variable item sizes, then the scroll jumps backwards a bit when reaching the end

I started working on it on another PR, but it's not trivial! I'll finish this later.

@pierpo
Copy link
Member

pierpo commented Oct 15, 2024

Closed in favor of #164

@pierpo pierpo closed this Oct 15, 2024
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.

2 participants