https://kotlinlang.org logo
#compose
Title
# compose
t

Tlaster

11/15/2020, 3:54 AM
Seems like using paging compose
items
with
LazyColumn
does not restore the scroll position when navigate back using navigation compose. Does anyone have the same issue?
a

Apex

11/15/2020, 6:51 AM
I was facing the same with compose alpha06 , will try upgrading my projects later and check if anything has changed
t

Tlaster

11/15/2020, 7:01 AM
I'm using compose alpha07 and both navigation and paging is alpha02.
j

jim

11/16/2020, 2:33 AM
If you hoist your scroll state up, you can manually restore/retain the scroll position.
t

Tlaster

11/16/2020, 5:42 AM
Still not able to restore the scroll position even manually save the
firstVisibleItemIndex
into shared preferences and restore by
initialFirstVisibleItemIndex
.
And I notice that
collectAsLazyPagingItems
will return different instance eveytime I navigate back.
I'm using a workaround not compose
LazyColumn
when
LazyPagingItems<T>.itemCount == 0
, and the scroll position is restored right now
m

Mantas Varnagiris

02/01/2021, 7:45 PM
Could you share how are you doing that? It seems like this is still a problem
4 Views