https://kotlinlang.org logo
c

Cyril Find

12/21/2020, 11:10 AM
Hi, How can I remember my
LazyColumn
scroll position aver navigating with compose navigation ? I thought hoisting a
LazyListState
up to my
NavHost
would work but it doesn’t apparently
a

allan.conda

12/21/2020, 11:13 AM
should work automatically. have you updated to alpha9?
c

Cyril Find

12/21/2020, 11:13 AM
yes
that’s what I thougt but it doesn’t, maybe I’m doing something else wrong
I didn’t mention im also using paging 3
m

Mantas Varnagiris

12/22/2020, 8:03 PM
I have the same issue. I thought it works but it doesn't. Also using paging 3
c

Cyril Find

12/23/2020, 1:49 PM
I’ve been trying stuff but nothing seems to work
t

Timo Drick

12/23/2020, 2:03 PM
If you think it is a bug you should try to create a minimal version to show the bug. Than it is also easier to see if you did some thing wrong.
c

Cyril Find

12/23/2020, 2:32 PM
yeah I didn’t get to it yet so I was wondering if it was a know issue
g

giso

12/25/2020, 10:10 AM
I have the same issue with compose-router. I also tried remembering the
LazyListState
at the root composable, but whenever the
LazyColumn
is recomposed, the scroll state is reset. Maybe this functionality is not implemented yet?
a

ak

02/04/2021, 10:06 PM
@Cyril Find were you able to find a fix or workaround this issue? I am on Compose alpha-11 and navigation compose alpha 06 and have not been able to solve... Thanks!
c

Cyril Find

02/04/2021, 10:42 PM
no, i filed a bug but it's not fixed yet 😞
👍 1
a

ak

02/08/2021, 7:33 PM
@Cyril Find this turned out to be my issue: https://issuetracker.google.com/issues/179397301 since i am not using the paging library. my list state looked like this:
Copy code
val listState = viewModel.gasStations.collectAsState(emptyList())
removing the
emptyList()
like so:
Copy code
val listState = viewModel.gasStations.collectAsState()
fixed my issue for now. Gave yours a anyways.
c

Cyril Find

02/09/2021, 8:52 AM
wow that's weird ! thanks for the feedback and the 😄
👍 1
7 Views