fix sliding banners on iOS 26

This commit is contained in:
Mauro Romito
2025-09-10 13:58:27 +02:00
committed by Stefan Ceriu
parent bc95be16d6
commit dd509db927
3 changed files with 15 additions and 2 deletions
@@ -29,6 +29,7 @@ struct KnockRequestsBannerView: View {
.background(.compound.bgCanvasDefaultLevel1, in: RoundedRectangle(cornerRadius: 12)) .background(.compound.bgCanvasDefaultLevel1, in: RoundedRectangle(cornerRadius: 12))
.compositingGroup() .compositingGroup()
.shadow(color: Color(red: 0.11, green: 0.11, blue: 0.13).opacity(0.1), radius: 12, x: 0, y: 4) .shadow(color: Color(red: 0.11, green: 0.11, blue: 0.13).opacity(0.1), radius: 12, x: 0, y: 4)
.padding(.bottom, 28)
.padding(.horizontal, 16) .padding(.horizontal, 16)
} }
@@ -23,6 +23,8 @@ struct PinnedItemsBannerView: View {
.padding(.leading, 16) .padding(.leading, 16)
.background(Color.compound.bgCanvasDefault) .background(Color.compound.bgCanvasDefault)
.shadow(color: Color(red: 0.11, green: 0.11, blue: 0.13).opacity(0.1), radius: 12, x: 0, y: 4) .shadow(color: Color(red: 0.11, green: 0.11, blue: 0.13).opacity(0.1), radius: 12, x: 0, y: 4)
// To include the shadow in the size
.padding(.bottom, 28)
} }
private var mainButton: some View { private var mainButton: some View {
@@ -77,20 +77,26 @@ struct RoomScreen: View {
@ViewBuilder @ViewBuilder
private var pinnedItemsBanner: some View { private var pinnedItemsBanner: some View {
Group { // Color.clear and clipped() are required for iOS 26 transparent nav bar
VStack(spacing: 0) {
if context.viewState.shouldShowPinnedEventsBanner { if context.viewState.shouldShowPinnedEventsBanner {
PinnedItemsBannerView(state: context.viewState.pinnedEventsBannerState, PinnedItemsBannerView(state: context.viewState.pinnedEventsBannerState,
onMainButtonTap: { context.send(viewAction: .tappedPinnedEventsBanner) }, onMainButtonTap: { context.send(viewAction: .tappedPinnedEventsBanner) },
onViewAllButtonTap: { context.send(viewAction: .viewAllPins) }) onViewAllButtonTap: { context.send(viewAction: .viewAllPins) })
.transition(.move(edge: .top)) .transition(.move(edge: .top))
} else {
Color.clear
.allowsHitTesting(false)
} }
} }
.animation(.elementDefault, value: context.viewState.shouldShowPinnedEventsBanner) .animation(.elementDefault, value: context.viewState.shouldShowPinnedEventsBanner)
.clipped()
} }
@ViewBuilder @ViewBuilder
private var knockRequestsBanner: some View { private var knockRequestsBanner: some View {
Group { // Color.clear and clipped() are required for iOS 26 transparent nav bar
VStack(spacing: 0) {
if context.viewState.shouldSeeKnockRequests { if context.viewState.shouldSeeKnockRequests {
KnockRequestsBannerView(requests: context.viewState.displayedKnockRequests, KnockRequestsBannerView(requests: context.viewState.displayedKnockRequests,
onDismiss: dismissKnockRequestsBanner, onDismiss: dismissKnockRequestsBanner,
@@ -99,9 +105,13 @@ struct RoomScreen: View {
mediaProvider: context.mediaProvider) mediaProvider: context.mediaProvider)
.padding(.top, 16) .padding(.top, 16)
.transition(.move(edge: .top)) .transition(.move(edge: .top))
} else {
Color.clear
.allowsHitTesting(false)
} }
} }
.animation(.elementDefault, value: context.viewState.shouldSeeKnockRequests) .animation(.elementDefault, value: context.viewState.shouldSeeKnockRequests)
.clipped()
} }
private func dismissKnockRequestsBanner() { private func dismissKnockRequestsBanner() {