Button changing color when navigating

Viewed 19

I made a function in View Extension which is adding a trailing button in navigation bar items.

func navButton(action: @escaping () -> Void) -> some View {
    navigationBarItems(trailing:
         NewNavButton(action: action)
    )
}

Button code is:

var body: some View {
    Button(action: action) {
        Text("New Nav Button")
            .padding(5)
    }
}

I also set up NavigationBar tint color to custom color, ut the problem is when I am using NavigationView and when I am navigating, button color is changed back to default iOS color like here:

enter image description here

0 Answers
Related