Merge pull request #7825 from element-hq/feature/fga/fix-home-scroll-connection

Fix home screen top bar consuming its own scroll events
This commit is contained in:
ganfra
2026-10-01 09:38:01 +02:00
committed by GitHub
@@ -184,7 +184,7 @@ private fun HomeScaffold(
val spacesLazyListState = rememberLazyListState() val spacesLazyListState = rememberLazyListState()
Scaffold( Scaffold(
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection), modifier = modifier,
topBar = { topBar = {
HomeTopBar( HomeTopBar(
selectedNavigationItem = state.currentHomeNavigationBarItem, selectedNavigationItem = state.currentHomeNavigationBarItem,
@@ -265,6 +265,13 @@ private fun HomeScaffold(
val contentPadding = PaddingValues( val contentPadding = PaddingValues(
bottom = 96.dp, 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) { when (state.currentHomeNavigationBarItem) {
HomeNavigationBarItem.Chats -> { HomeNavigationBarItem.Chats -> {
RoomListContentView( RoomListContentView(
@@ -303,6 +310,7 @@ private fun HomeScaffold(
) )
} }
} }
}
}, },
snackbarHost = { SnackbarHost(snackbarHostState) }, snackbarHost = { SnackbarHost(snackbarHostState) },
) )