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

nglauber

07/05/2020, 5:37 PM
New question 😛 : Is there a way to save the scroll position of a
LazyColumnItems
? I’m using a
TabRow
to display two tabs and each one display a list of content. When I swap between the tabs, the scroll position of the list is lost.
👍 3
t

Timo Drick

07/05/2020, 7:50 PM
It is not supported. As a temporary solution you could use this code snippet instead: https://gitlab.com/timod/compose-playground/-/blob/master/compose_list/src/main/java/de/drick/compose/list/LayoutList.kt
👍 1
n

nglauber

07/05/2020, 7:55 PM
Not so simple 😅 I hope Jetpack team tackle this soon.
t

Timo Drick

07/05/2020, 7:56 PM
You can use it the same way LazyColumnItems. E.g.:
Copy code
VerticalLayoutList(items = modelList) { item ->
n

nglauber

07/05/2020, 7:58 PM
That’s good… Why don’t you publish this as a lib?
t

Timo Drick

07/05/2020, 7:58 PM
I am currently working on this 😄 Its already prepared to create a local maven repo
👏 1
🚀 1
For now you can just copy the code from this single file. It is all you need.