react-stay-scrolled
react-stay-scrolled copied to clipboard
Support for prepending items to list and keeping scroll
I am building a chat application where the user starts at the bottom of a list of messages and scrolls upward, infinitely loading items which in turn prepends them to the list.
Would this package support starting at the bottom and allowing a user to infinitely scroll upwards while maintaining their scroll position?
Similarly to Slack or Microsoft Teams?
Thanks for this awesome lib
Hey!
If I understand correctly, the option you are looking for is initialScroll. I think this lib should be able to help with your usecase, but feel free to send me a PR if you find any shortcomings :)
I have exactly the same usecase. An example where the customer scrolls up to the top, then new messages are added, while the scrollbar position is maintained exactly where the customer was left, would be really appreciated.