mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-10-31 16:22:49 +00:00
Fix home screen top bar consuming its own scroll events
This commit is contained in:
+45
-37
@@ -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 = {},
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user