Disable automatic scroll when adding new items to list


#1

Hello,

I have a chat in my app and i wanted to load small pieces of the conversation instead of loading everything once (for performance reasons)
When the user reaches the top of the content i load more messages, but there is a scroll issue, it automatically scroll at the very top of the page (so the oldest messages) instead of sticking at the actual position of the page.
I tried this workaround but the result is really weird, and the scroll will «jump» at the top and come back at the inital position, which is not nice at all :confused:

So i’m just wondering if it was possible to disable the «automatic scroll» applied when you add new items to a list, that would be great !

Thanks,


#2

I have the same problem, did you find a neater solution to it?


#3

This is an old question, but this answer could help someone.

Think about books stacked on top of each other. It has some initial height before adding a/few book(s). You just need subtract “old-height” from “new-height” to remain at the last known book index/positoin.

If you have added auto-scroll feature when a new message comes on chat page, you would need to avoid that from triggering somehow or you can quickly scroll to your previous scrolled location as soon as new message(s) come(s) to page. Look at solution using code