I encountered a strange problem since iOS 15: I have a Blur Effect on the App's Root View, which changes depending on the scenePhase.
This was working perfectly until iOS 15 got released. Now, whenever the Blur Effect is 0, the Status Bar of the App collapses and the Navigation Bar moves up and is no more interactable.
struct RootView: View {
@Environment(\.scenePhase) var scenePhase
@State private var blurRadius: CGFloat = 0
var body: some View {
Group {
OtherViews()
}
.blur(radius: blurRadius)
.onChange(of: scenePhase) { newValue in updateBlurRadius(newValue) }
}
private func updateBlurRadius(_ scenePhase: ScenePhase) {
switch scenePhase {
case .active : withAnimation { blurRadius = 0 }
case .inactive: withAnimation { blurRadius = 16 }
case .background: withAnimation { blurRadius = 16 }
@unknown default: print("Unknown Case")
}
}
}
This code worked fine for iOS 14 and before. However, since iOS 15, the following bug appears:
- The curious thing is, that when the
scenePhasebecomesinactive, theNavigation Barinstantly jumps into its proper spot. And as soon as thescenePhasebecomesactiveagain, it jumps back to the top behind theStatus Bar. - Also, when changing the
Blur Radiusfor theactivescenePhaseto 0.001 instead of 0, everything works perfectly fine and theNavigation Bardoes not jump behind theStatus Bar.
Does anyone have an idea what could cause this strange behavior when working with Blur Effects?
Thanks a lot for your help in advance.
