Does this remember scroll position and `snapToInde...
# compose
k
Does this remember scroll position and
snapToIndex
APIs for LazyColumn are added in
alpha08
? I'm using
alpha07
and I do get behavior of remembering scroll position on putting app background but it's not working when I switch the tab and come back (I'm using multi backstack Navigation) so I was expecting it to work
a
snapToIndex
was added in alpha08. the scroll position issue is different I think. I am not sure how you implemented tabs, but the general rule for Navigation is that if the current screen is removed from the backstack its state is also removed. and when you open this screen again it is a fresh start for the screen
k
So is there any way I could manually manage restore scroll position using
savedInstanceState
or any other approach? I guess I might need to upgrade to
alpha08
for that
j
Yes, you can manually hoist the state such that it is stored above the navigation (stored within your application data) and passed into the composables as needed, and then you have full flexibility to decide when your app will retain/discard the state.
👍 1