Should `rememberSaveableStateHolder()` restore the...
# compose
t
Should
rememberSaveableStateHolder()
restore the scroll state of a
LazyColumn
in a child composable?
Code:
Copy code
@Composable
fun HomeContent(
    currentScreen: Screen,
    modifier: Modifier = Modifier,
    content: @Composable (Screen) -> Unit
) {
    val stateHolder = rememberSaveableStateHolder()

    Crossfade(targetState = currentScreen) { screen ->
        Box(modifier) {
            stateHolder.SaveableStateProvider(screen.key) {
                content(screen)
            }
        }
    }
}
Switching screens and back jumps the list to the top every time, although I'm also using
paging-compose
which may affect this
(In the snippet,
content(screen)
runs a
LazyColumn
in one of the screens)
z
👍 1
t
ah, thanks!