fix the issue where the empty state overlaps the banner if present

This commit is contained in:
Mauro Romito
2026-05-29 15:10:05 +02:00
committed by Stefan Ceriu
parent 0c9c06047a
commit 63d33efb5e
@@ -16,6 +16,8 @@ struct HomeScreenContent: View {
@ObservedObject var context: HomeScreenViewModel.Context
let scrollViewAdapter: ScrollViewAdapter
@State private var topSectionHeight: CGFloat = 0
var body: some View {
roomList
.sentryTrace("\(Self.self)")
@@ -47,7 +49,10 @@ struct HomeScreenContent: View {
case .rooms:
LazyVStack(spacing: 0) {
Section {
if !context.viewState.shouldShowEmptyFilterState {
if context.viewState.shouldShowEmptyFilterState {
RoomListFiltersEmptyStateView(state: context.filtersState)
.frame(maxWidth: .infinity, minHeight: max(0, geometry.size.height - topSectionHeight))
} else {
HomeScreenRoomList(context: context)
}
} header: {
@@ -99,13 +104,6 @@ struct HomeScreenContent: View {
scrollView.setContentOffset(oldOffset, animated: false)
}
}
.overlay {
if context.viewState.shouldShowEmptyFilterState {
RoomListFiltersEmptyStateView(state: context.filtersState)
.background(.compound.bgCanvasDefault)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
.scrollDismissesKeyboard(.immediately)
.scrollDisabled(context.viewState.roomListMode == .skeletons)
.scrollBounceBehavior(context.viewState.roomListMode == .empty ? .basedOnSize : .automatic)
@@ -130,6 +128,7 @@ struct HomeScreenContent: View {
}
}
.background(Color.compound.bgCanvasDefault)
.onGeometryChange(for: CGFloat.self, of: \.size.height) { topSectionHeight = $0 }
}
}