How can I keep away from the flickering ToolbarItem
when switching between tabs, whereas nonetheless maintaining a devoted NavigationStack
for every Tab
?
I’ve unsuccessfully tried:
- Nesting the
TabView
inside one otherNavigationStack
, however that appears to be a unhealthy thought and in addition breaks switching to a unique tab whereas having a element view open ToolbarItem(id: "SomeId")
for each buttons modifications nothing- Including a
.background(.purple, in: .capsule)
works for the within of the button, however there’s nonetheless a border round it that I am unable to do away with .buttonStyle(.plain)
does nothing
struct MyTabView: View {
var physique: some View {
TabView {
Tab {
MyNavStack()
} label: {
Picture(systemName: "home")
}
Tab {
MyNavStack()
} label: {
Picture(systemName: "star")
}
}
}
}
struct MyNavStack: View {
var physique: some View {
NavigationStack {
Listing {
NavigationLink("Mint", worth: Coloration.mint)
NavigationLink("Pink", worth: Coloration.pink)
}
.navigationDestination(for: Coloration.self) { shade in
Textual content("You chose (shade.description)")
}
.toolbar {
ToolbarItem(placement: .topBarLeading) {
Button("Glints") { }
}
}
}
}
}