Closed icd2k3 closed 1 month ago
Pretty sure this is already possible, I was playing with it today: You can use the "smart" option:
listRef.current?.scrollToItem(scrollToIndex, 'smart');
From the JSDocs:
- smart
If the item is already visible, don't scroll at all.
If it is less than one viewport away, scroll as little as possible so that it becomes visible.
If it is more than one viewport away, scroll so that it is centered within the list.
Is this possible? I only want to scroll to an item if it's outside of the viewable area.