ToolbarItem changes on pop of navigation stack

Hi everyone,

I am using toolbarItem for View1 of a NavigationView. After navigating to View2 and going back the toolbarItem appears trimmed. Here is some minimal code to reproduce:

struct ContentView: View {
    var body: some View {
        NavigationView {
            NavigationLink(
                destination: Text("Second View"),
                label: {
                    Text("Navigate")
                })
                .toolbar(content: {
                    ToolbarItem {
                        Image(systemName: "circle.fill")
                            .resizable()
                            .scaledToFit()
                            .frame(width: 60, height: 60)
                    }
                })
        }
        .navigationViewStyle(StackNavigationViewStyle())
    }
}

I suspect somehow the height of the second navigation bar is remembered and it squeezes the toolbarItem. Does anyone know how to fix this?

This post was flagged by the community and is temporarily hidden.

Terms of Service

Privacy Policy

Cookie Policy