ios – TabView embedded in NavigationView pushes content down

ios – TabView embedded in NavigationView pushes content down

ios – TabView embedded in NavigationView pushes content down

I embedded a TabView in a NavigationView and the Text in the view gets pushed down slightly. I’ve tried moving the views around however it just ends up breaking functionally. You can see the green text is not vertically aligned to the rest of the device, but instead aligned to the content under the navigation bar.

enter image description here

var body: some View {
    NavigationView{
        
        TabView {
            Text("TEST 1").foregroundColor(color).font(Font.custom("Catamaran-ExtraBold", size: 48)).navigationTitle("TEST 1")
            
            Text("TEST 2").foregroundColor(color).font(Font.custom("Catamaran-ExtraBold", size: 48)).navigationTitle("TEST 2")
        }
        
        .foregroundColor(.black).navigationBarTitleDisplayMode(.inline)
        .font(Font.custom("Catamaran-ExtraBold", size: 20))
        .navigationBarItems(
            leading:
                NavigationLink(destination: SettingsView(), label: {
                    Image(systemName: "gearshape")
                })).foregroundColor(colorScheme == .dark ? .white : .black)
        
        
    }
    .navigationViewStyle(.stack)
    .ignoresSafeArea()
    .tabViewStyle(.page)
    .indexViewStyle(.page(backgroundDisplayMode: .always))
}

Source link

Leave a Reply

Your email address will not be published. Required fields are marked *