Modify scrollToIndex when item larger than viewport #538
jackhodkinson
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
Hi, thank you for the suggestion. I think adding And |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am working with a case where items are often larger than the viewport. In that case the default behavior of
Scroller._scrollToIndex(index, { align: 'nearest'})
is undesired. When scrolling to an item below the viewport it results inalign = "end"
which feels un-natural because it skips past the beginning of the item.I recognize the desired behavior may be subjective, so if you'd prefer to keep the existing code I'd like to expose
VirtualStore._getItemSize
in theVirtualizerHandle
:Or if you are open to changing the default behavior I'd suggest modifying
Scroller._scrollToIndex
to take into account the item size and viewport size whenalign === "nearest"
:Let me know what you think! Thanks as always for maintaining such an awesome library.
Beta Was this translation helpful? Give feedback.
All reactions