mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 20:38:40 +00:00
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:
+45
-37
@@ -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,42 +265,50 @@ private fun HomeScaffold(
|
|||||||
val contentPadding = PaddingValues(
|
val contentPadding = PaddingValues(
|
||||||
bottom = 96.dp,
|
bottom = 96.dp,
|
||||||
)
|
)
|
||||||
when (state.currentHomeNavigationBarItem) {
|
// The nested scroll connection is set on the content and not on the Scaffold, else the top bar would
|
||||||
HomeNavigationBarItem.Chats -> {
|
// consume the scroll events of its own content.
|
||||||
RoomListContentView(
|
Box(
|
||||||
contentState = roomListState.contentState,
|
modifier = Modifier
|
||||||
filtersState = roomListState.filtersState,
|
.fillMaxSize()
|
||||||
spaceFiltersState = roomListState.spaceFiltersState,
|
.nestedScroll(scrollBehavior.nestedScrollConnection)
|
||||||
lazyListState = roomsLazyListState,
|
) {
|
||||||
hideInvitesAvatars = roomListState.hideInvitesAvatars,
|
when (state.currentHomeNavigationBarItem) {
|
||||||
eventSink = roomListState.eventSink,
|
HomeNavigationBarItem.Chats -> {
|
||||||
onSetUpRecoveryClick = onSetUpRecoveryClick,
|
RoomListContentView(
|
||||||
onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick,
|
contentState = roomListState.contentState,
|
||||||
onRoomClick = ::onRoomClick,
|
filtersState = roomListState.filtersState,
|
||||||
onCreateRoomClick = onStartChatClick,
|
spaceFiltersState = roomListState.spaceFiltersState,
|
||||||
contentPadding = lazyColumnContentPadding + contentPadding,
|
lazyListState = roomsLazyListState,
|
||||||
modifier = Modifier
|
hideInvitesAvatars = roomListState.hideInvitesAvatars,
|
||||||
.padding(outerPadding)
|
eventSink = roomListState.eventSink,
|
||||||
.consumeWindowInsets(outerPadding)
|
onSetUpRecoveryClick = onSetUpRecoveryClick,
|
||||||
)
|
onConfirmRecoveryKeyClick = onConfirmRecoveryKeyClick,
|
||||||
SpaceFiltersView(roomListState.spaceFiltersState)
|
onRoomClick = ::onRoomClick,
|
||||||
}
|
onCreateRoomClick = onStartChatClick,
|
||||||
HomeNavigationBarItem.Spaces -> {
|
contentPadding = lazyColumnContentPadding + contentPadding,
|
||||||
HomeSpacesView(
|
modifier = Modifier
|
||||||
modifier = Modifier
|
.padding(outerPadding)
|
||||||
.fillMaxSize()
|
.consumeWindowInsets(outerPadding)
|
||||||
.padding(outerPadding)
|
)
|
||||||
.consumeWindowInsets(outerPadding),
|
SpaceFiltersView(roomListState.spaceFiltersState)
|
||||||
contentPadding = lazyColumnContentPadding + contentPadding,
|
}
|
||||||
state = state.homeSpacesState,
|
HomeNavigationBarItem.Spaces -> {
|
||||||
lazyListState = spacesLazyListState,
|
HomeSpacesView(
|
||||||
onSpaceClick = { spaceId ->
|
modifier = Modifier
|
||||||
onRoomClick(spaceId)
|
.fillMaxSize()
|
||||||
},
|
.padding(outerPadding)
|
||||||
onCreateSpaceClick = onCreateSpaceClick,
|
.consumeWindowInsets(outerPadding),
|
||||||
// TODO use actual callbacks for this
|
contentPadding = lazyColumnContentPadding + contentPadding,
|
||||||
onExploreClick = {},
|
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