Billy Newman

06/20/2022, 6:51 PM
Hello all, having trouble wrapping my head around an infinite lazycolumn using the pager v3 library. I would like to scroll up infinitely as new “un-viewed” items are available. This means that on initial load of the view, I would like to start the user at the bottom of the list, not the top.
Currently I am scrolling to the last item a user has viewed, in the case of never viewed I start them at the bottom. To do both scrolls I am using:
val listState = rememberLazyListState()
However I think that is pretty inefficient on first load, or a load with a lot of un-viewed items. Assuming that scrollToItem(index) is loading each item as it scrolls.


06/20/2022, 7:48 PM
rememberLazyListState takes index of the item that should be visible

Ian Lake

06/20/2022, 7:55 PM
Generally, that's the use case for LazyColumn's
, which starts you at the bottom and you scroll up to view more
☝️ 1

Billy Newman

06/20/2022, 7:58 PM
@dorche thanks, missed that. Guess I need some sleep ;). Ian agreed, I just saw that option messing around with it now. Seems that in combination with constructing the list state with the right index is the way to go.