HomeiOS DevelopmentToolbarItem sparkles when switching between tabs in iOS 26

ToolbarItem sparkles when switching between tabs in iOS 26


How can I keep away from the flickering ToolbarItem when switching between tabs, whereas nonetheless maintaining a devoted NavigationStack for every Tab?

ToolbarItem sparkles when switching between tabs in iOS 26

I’ve unsuccessfully tried:

  • Nesting the TabView inside one other NavigationStack, 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") { }
                }
            }
        }
    }
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments