I am utilizing navigationStack and I discovered that after I again programmatically as an alternative of utilizing default again button on navigation bar. My ToolbarColorScheme is change from darkish to white.
Right here is my demo to breed this bug, for some reasone I’ve to make use of navigation stack. So can anybody give me some solution to repair this drawback however preserve utilizing navigationStack.
Thankyou!
struct TestView: View {
personal var bgColors: [Color] = [ .indigo, .yellow, .green, .orange, .brown ]
@State personal var path: [Color] = []
var physique: some View {
NavigationStack(path: $path) {
Record(bgColors, id: .self) { bgColor in
NavigationLink(worth: bgColor) {
Textual content(bgColor.description)
}
}
.toolbarColorScheme(.darkish, for: .navigationBar)
.toolbarBackground(
AppColor.blue,
for: .navigationBar)
.toolbarBackground(.seen, for: .navigationBar)
.listStyle(.plain)
.navigationDestination(for: Coloration.self) { coloration in
VStack {
Textual content("(path.depend), (path.description)")
.font(.headline)
HStack {
ForEach(path, id: .self) { coloration in
coloration
.body(maxWidth: .infinity, maxHeight: .infinity)
}
}
Button {
path.removeLast()
} label: {
Textual content("Again")
}
}
.toolbarColorScheme(.darkish, for: .navigationBar)
.toolbarBackground(
AppColor.blue,
for: .navigationBar)
.toolbarBackground(.seen, for: .navigationBar)
}
.navigationTitle("Coloration")
}
}
}