Method to stick to bottom of scroller as content increases
Is your feature request related to a problem? Please describe.
Instead of requiring to scroll to last item in the index each time the content changes, it would be nice if there was a built in method which would automatically stick to the bottom of the virtualised scroll section as content changes.
Describe the solution you'd like
Either a method / prop on the component stickToBottom or an api method that can be toggled.
Describe alternatives you've considered
useEffect on data length and scroll to last in index whenever it changes.
There are many ways to do this poorly, but for something "flicker free" you need to directly access the scrolling element (parent of the Virtualizer. The scrollRef).
Watch for changes to the scrolling element with a MutationObserver then set el.scrollTop = el.scrollHeight.
Use virtua and react APIs sparingly, any delay (async etc) will introduce flickering.
Basically, we will not add any APIs specific to chat use case to virtua.
onResizeViewport like prop might be added in #301 and #408, if the event hook is appropriate.
And also I can recommend chat-viewer for chat. It seems to be built on virtua for now, and it has followAtBottom API.
Alright great!
We use this for a fast updating logs viewer that takes updates from an eventstream but will give these a shot, thank you.