Post

Replies

Boosts

Views

Activity

Reply to [iOS, SwiftUI] Navigation Bar background is always hidden when navigation destination is TabView
[quote='824980022, DTS Engineer, /thread/774036?answerId=824980022#824980022'] First could use try using toolbarBackgroundVisibility(_:for:) to set the visibility of the background bar or toolbarBackground(_:for:) to specify the specified style. [/quote] 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) } } }
Topic: UI Frameworks SubTopic: SwiftUI Tags:
Feb ’25