Christopher Mederos
07/08/2024, 8:00 AMval scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
Scaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = { TopAppBar(scrollBehavior = scrollBehavior, title = {...})
) { paddingValues ->
val state = rememberLazyListState()
LaunchedEffect(...) { state.animateScrollToItem(0) }
LazyColumn(state = state) {...}
}
The scroll position is moved to the top as expected. However, the upwards scroll doesn't seem to trigger the enterAlwaysScrollBehavior for revealing the TopAppBar againTolriq
07/08/2024, 8:05 AMChristopher Mederos
07/08/2024, 8:33 AMLaunchedEffect(...) {
scrollBehavior.nestedScrollConnection.onPreScroll(Offset.Infinite, NestedScrollSource.SideEffect)
state.animateScrollToItem(0)
}
Tolriq
07/08/2024, 8:36 AMChristopher Mederos
07/08/2024, 8:37 AMTolriq
07/08/2024, 8:40 AMAlbert Chang
07/08/2024, 12:21 PMscrollBehavior.state.apply {
heightOffset = 0f
contentOffset = 0f
}