Fix home screen top bar consuming its own scroll events

This commit is contained in:
ganfra
2026-09-30 18:02:19 +02:00
parent 7502ab16c5
commit ff8bb78f12
@@ -184,7 +184,7 @@ private fun HomeScaffold(
val spacesLazyListState = rememberLazyListState()
Scaffold(
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
modifier = modifier,
topBar = {
HomeTopBar(
selectedNavigationItem = state.currentHomeNavigationBarItem,
@@ -265,6 +265,13 @@ private fun HomeScaffold(
val contentPadding = PaddingValues(
bottom = 96.dp,
)
// The nested scroll connection is set on the content and not on the Scaffold, else the top bar would
// consume the scroll events of its own content.
Box(
modifier = Modifier
.fillMaxSize()
.nestedScroll(scrollBehavior.nestedScrollConnection)
) {
when (state.currentHomeNavigationBarItem) {
HomeNavigationBarItem.Chats -> {
RoomListContentView(
@@ -303,6 +310,7 @@ private fun HomeScaffold(
)
}
}
}
},
snackbarHost = { SnackbarHost(snackbarHostState) },
)