react-cool-virtual icon indicating copy to clipboard operation
react-cool-virtual copied to clipboard

Add easier way to scroll to the bottom of the list

Open sartak opened this issue 2 years ago • 0 comments

Feature Request

Describe the Feature

I'd like a way to scroll to the bottom of the list.

Describe the Solution You'd Like

Either a scrollToBottom callback, or have the scrollTo callback take an option to go to the bottom.

const { scrollToBottom } = useVirtual({…});
scrollToBottom();
scrollToBottom({ smooth: true });
const { scrollTo } = useVirtual({…});
scrollTo("bottom");
scrollTo({ offset: "bottom", smooth: true });

Describe Alternatives You've Considered

I currently implement this with scrollToItem({ index: itemCount - 1, align: "end" });, though it required me rearranging some code. This is also what's used in the "stick to bottom" example.

Additional Information

Thanks!

sartak avatar Oct 29 '23 16:10 sartak