I’m working with SwiftUI’s Navigation Stack and Tab Bar/Tab Bar Style and before setting the tab bar style to page everything works as expected. Here is an example:
Code:
struct TabsView: View {
enum Tab {
case home
}
@State private var selectedTab: Tab = .home
var body: some View {
TabView(selection: $selectedTab) {
NavigationStack {
ScrollView {
Text("Home Screen")
.navigationTitle("Home")
.navigationBarTitleDisplayMode(.inline)
.toolbar(.visible, for: .navigationBar)
.toolbarBackground(.visible, for: .navigationBar)
}
}
.tabItem {
Image(systemName: "square")
}
.tag(Tab.home)
}
}
}
But as soon as I add the .tabViewStyle(.page), it breaks. It does not take up the full height as expected for the navigation bar. Also, the text is now hidden behind the navigation bar:
Code:
struct TabsView: View {
enum Tab {
case home
}
@State private var selectedTab: Tab = .home
var body: some View {
TabView(selection: $selectedTab) {
NavigationStack {
ScrollView {
Text("Home Screen")
.navigationTitle("Home")
.navigationBarTitleDisplayMode(.inline)
.toolbar(.visible, for: .navigationBar)
.toolbarBackground(.visible, for: .navigationBar)
}
}
.tabItem {
Image(systemName: "square")
}
.tag(Tab.home)
}
.tabViewStyle(.page)
}
}






