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 @ObservedObject var context: HomeScreenViewModel.Context
let scrollViewAdapter: ScrollViewAdapter let scrollViewAdapter: ScrollViewAdapter
@State private var topSectionHeight: CGFloat = 0
var body: some View { var body: some View {
roomList roomList
.sentryTrace("\(Self.self)") .sentryTrace("\(Self.self)")
@@ -47,7 +49,10 @@ struct HomeScreenContent: View {
case .rooms: case .rooms:
LazyVStack(spacing: 0) { LazyVStack(spacing: 0) {
Section { 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) HomeScreenRoomList(context: context)
} }
} header: { } header: {
@@ -99,13 +104,6 @@ struct HomeScreenContent: View {
scrollView.setContentOffset(oldOffset, animated: false) scrollView.setContentOffset(oldOffset, animated: false)
} }
} }
.overlay {
if context.viewState.shouldShowEmptyFilterState {
RoomListFiltersEmptyStateView(state: context.filtersState)
.background(.compound.bgCanvasDefault)
.frame(maxWidth: .infinity, maxHeight: .infinity)
}
}
.scrollDismissesKeyboard(.immediately) .scrollDismissesKeyboard(.immediately)
.scrollDisabled(context.viewState.roomListMode == .skeletons) .scrollDisabled(context.viewState.roomListMode == .skeletons)
.scrollBounceBehavior(context.viewState.roomListMode == .empty ? .basedOnSize : .automatic) .scrollBounceBehavior(context.viewState.roomListMode == .empty ? .basedOnSize : .automatic)
@@ -130,6 +128,7 @@ struct HomeScreenContent: View {
} }
} }
.background(Color.compound.bgCanvasDefault) .background(Color.compound.bgCanvasDefault)
.onGeometryChange(for: CGFloat.self, of: \.size.height) { topSectionHeight = $0 }
} }
} }