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 ace68b4ff4
commit ad833e9a77
3 changed files with 15 additions and 2 deletions

View File

@@ -29,6 +29,7 @@ struct KnockRequestsBannerView: View {
.background(.compound.bgCanvasDefaultLevel1, in: RoundedRectangle(cornerRadius: 12))
.compositingGroup()
.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)
}

View File

@@ -23,6 +23,8 @@ struct PinnedItemsBannerView: View {
.padding(.leading, 16)
.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)
// To include the shadow in the size
.padding(.bottom, 28)
}
private var mainButton: some View {

View File

@@ -77,20 +77,26 @@ struct RoomScreen: View {
@ViewBuilder
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 {
PinnedItemsBannerView(state: context.viewState.pinnedEventsBannerState,
onMainButtonTap: { context.send(viewAction: .tappedPinnedEventsBanner) },
onViewAllButtonTap: { context.send(viewAction: .viewAllPins) })
.transition(.move(edge: .top))
} else {
Color.clear
.allowsHitTesting(false)
}
}
.animation(.elementDefault, value: context.viewState.shouldShowPinnedEventsBanner)
.clipped()
}
@ViewBuilder
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 {
KnockRequestsBannerView(requests: context.viewState.displayedKnockRequests,
onDismiss: dismissKnockRequestsBanner,
@@ -99,9 +105,13 @@ struct RoomScreen: View {
mediaProvider: context.mediaProvider)
.padding(.top, 16)
.transition(.move(edge: .top))
} else {
Color.clear
.allowsHitTesting(false)
}
}
.animation(.elementDefault, value: context.viewState.shouldSeeKnockRequests)
.clipped()
}
private func dismissKnockRequestsBanner() {