[iOS, SwiftUI] Navigation Bar background is always hidden when navigation destination is TabView

Hello!

I have a destination navigation which is TabVIew where each tab item is ScrollView. And when scrolling content of any of tab items is underneath navigation bar its background is always hidden. But at the same time tab bar background is toggled depending on scrolling content position.

I expected it would work with TabView the same as with any other view.

Is it supposed to work like that?

@pavelpugachh

First could use try using toolbarBackgroundVisibility(_:for:) to set the visibility of the background bar or toolbarBackground(_:for:) to specify the specified style.

If that fails, then you would need to provide a complete code snippet that reproduces the issue you described.

First could use try using toolbarBackgroundVisibility(_:for:) to set the visibility of the background bar or toolbarBackground(_:for:) to specify the specified style.

Now I have to set toolbar background visibility using toolbarBackground(_:for:) via a variable along with GeometryReader tracking y offset to make it work as I described. But I expected it to work out of the box like for any other navigation destination.

Code snippet to reproduce the issue.

        NavigationStack {
            List {
                NavigationLink("Not TabView", value: true)
                NavigationLink("TabView", value: false)
            }
            .navigationDestination(for: Bool.self) { value in
                if value {
                    ScrollView {
                        Color.gray
                            .frame(height: 2000) // for scrolling to be appeared
                            .padding()
                    }
                    .navigationTitle("Not TabView")
                    .navigationBarTitleDisplayMode(.inline)
                } else {
                    TabView {
                        ScrollView {
                            Color.gray
                                .frame(height: 2000) // for scrolling to be appeared
                                .padding()
                        }
                        .tabItem {
                            Label("Tab 1", systemImage: "apple.logo")
                        }
                    }
                    .navigationTitle("TabView")
                    .navigationBarTitleDisplayMode(.inline)
                }
            }
        }
[iOS, SwiftUI] Navigation Bar background is always hidden when navigation destination is TabView
 
 
Q