diff --git a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeView.kt b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeView.kt index c6c02ca17b..bcc3229598 100644 --- a/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeView.kt +++ b/features/home/impl/src/main/kotlin/io/element/android/features/home/impl/HomeView.kt @@ -184,7 +184,7 @@ private fun HomeScaffold( val spacesLazyListState = rememberLazyListState() Scaffold( - modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection), + modifier = modifier, topBar = { HomeTopBar( selectedNavigationItem = state.currentHomeNavigationBarItem, @@ -265,42 +265,50 @@ private fun HomeScaffold( val contentPadding = PaddingValues( bottom = 96.dp, ) - when (state.currentHomeNavigationBarItem) { - HomeNavigationBarItem.Chats -> { - RoomListContentView( - contentState = roomListState.contentState, - filtersState = roomListState.filtersState, - spaceFiltersState = roomListState.spaceFiltersState, - lazyListState = roomsLazyListState, - hideInvitesAvatars = roomListState.hideInvitesAvatars, - eventSink = roomListState.eventSink, - onSetUpRecoveryClick = onSetUpRecoveryClick, - onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick, - onRoomClick = ::onRoomClick, - onCreateRoomClick = onStartChatClick, - contentPadding = lazyColumnContentPadding + contentPadding, - modifier = Modifier - .padding(outerPadding) - .consumeWindowInsets(outerPadding) - ) - SpaceFiltersView(roomListState.spaceFiltersState) - } - HomeNavigationBarItem.Spaces -> { - HomeSpacesView( - modifier = Modifier - .fillMaxSize() - .padding(outerPadding) - .consumeWindowInsets(outerPadding), - contentPadding = lazyColumnContentPadding + contentPadding, - state = state.homeSpacesState, - lazyListState = spacesLazyListState, - onSpaceClick = { spaceId -> - onRoomClick(spaceId) - }, - onCreateSpaceClick = onCreateSpaceClick, - // TODO use actual callbacks for this - onExploreClick = {}, - ) + // 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( + contentState = roomListState.contentState, + filtersState = roomListState.filtersState, + spaceFiltersState = roomListState.spaceFiltersState, + lazyListState = roomsLazyListState, + hideInvitesAvatars = roomListState.hideInvitesAvatars, + eventSink = roomListState.eventSink, + onSetUpRecoveryClick = onSetUpRecoveryClick, + onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick, + onRoomClick = ::onRoomClick, + onCreateRoomClick = onStartChatClick, + contentPadding = lazyColumnContentPadding + contentPadding, + modifier = Modifier + .padding(outerPadding) + .consumeWindowInsets(outerPadding) + ) + SpaceFiltersView(roomListState.spaceFiltersState) + } + HomeNavigationBarItem.Spaces -> { + HomeSpacesView( + modifier = Modifier + .fillMaxSize() + .padding(outerPadding) + .consumeWindowInsets(outerPadding), + contentPadding = lazyColumnContentPadding + contentPadding, + state = state.homeSpacesState, + lazyListState = spacesLazyListState, + onSpaceClick = { spaceId -> + onRoomClick(spaceId) + }, + onCreateSpaceClick = onCreateSpaceClick, + // TODO use actual callbacks for this + onExploreClick = {}, + ) + } } } },