SwiftUI: Malfunctioning NavigationBar and TabBar in iOS 15

In SwiftUI, I would like to use a background color for my view while also setting navigationViewStyle to .stack, to force a single-column stack navigation Plus-sized devices.

var body: some View {
    TabView {
        NavigationView {
            ScrollView {
                ForEach(0..<100) { _ in
                    Text("Bubble")
                        .padding()
                }
                .frame(maxWidth: .infinity)
            }
            .navigationTitle("Foam")
//            .background(Color.yellow) // I can do this …
        }
//        .navigationViewStyle(.stack) // … or this, but not both!
        .tabItem {
            Label("Beer", systemImage: "swift")
        }
    }
}

However, when I do both, the navigation bar won't collapse when I scroll down. Also both the navigation bar and tab bar appear without background.

When I only set the background, but leave out the line that sets the navigationViewStyle, everything looks fine in portrait mode, or smaller devices. But on a Plus-size device in landscape, it looks like this:

So I guess I really can't do this without setting the navigationViewStyle.

What can I do to fix this? Is this a bug that should be fixed by Apple? All help is greatly appreciated.

I'm running into the same issue and I haven't found a good workaround — other than removing the NavigationView, which requires a lot of additional work...

I'm facing this exact same issue as well. Whenever adding a background to the view inside a NavigationView inside a TabView, the collapsing behavior of the navigation bar no longer works. Have you found a workaround for it yet?

I am running into the same issue myself.

SwiftUI: Malfunctioning NavigationBar and TabBar in iOS 15
 
 
Q