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

Nthily

09/24/2023, 2:07 PM
Hi folks, I have a question about
LazyListState
I created a top-level
LazyListState
in a
@Composable
with
Scaffold
, which controls the
LazyList
on the homepage. However, my app has a multi account feature where users can switch accounts to view their homepage content. I want
LazyListState
to update the
initialFirstVisibleItemIndex
parameter when switching accounts, so that after the homepage initialization is completed, it can display the last place the account was viewed. But I cannot create a
LazyListState
on the homepage because I have a feature where when user clicks the`bottomBar` of homepage, the
LazyList
will scroll to the top, so I need to hoist the
LazyListState
to the top level (in Scaffold). Any good ideas?