Fix settings reacting to language change
This commit is contained in:
@ -3,8 +3,8 @@ import SFSafeSymbols
|
||||
|
||||
struct NavigationBarSettingsView: View {
|
||||
|
||||
@Environment(\.language)
|
||||
private var language
|
||||
@Binding
|
||||
var language: ContentLanguage
|
||||
|
||||
@EnvironmentObject
|
||||
private var content: Content
|
||||
@ -30,16 +30,17 @@ struct NavigationBarSettingsView: View {
|
||||
}
|
||||
.buttonStyle(.plain)
|
||||
}
|
||||
|
||||
ForEach(content.settings.navigation.navigationItems) { tag in
|
||||
TagView(text: tag.title(in: language))
|
||||
.foregroundStyle(.white)
|
||||
FlowHStack {
|
||||
ForEach(content.settings.navigation.navigationItems) { tag in
|
||||
TagView(text: tag.title(in: language))
|
||||
.foregroundStyle(.white)
|
||||
}
|
||||
}
|
||||
Text("Select the tags to show in the navigation bar. The number should be even.")
|
||||
Text("Select the tags to show in the navigation bar.")
|
||||
.foregroundStyle(.secondary)
|
||||
. padding(.bottom)
|
||||
|
||||
LocalizedNavigationBarSettingsView(settings: content.settings.navigation.localized(in: language))
|
||||
let localized = content.settings.navigation.localized(in: language)
|
||||
LocalizedNavigationBarSettingsView(settings: localized)
|
||||
}
|
||||
.padding()
|
||||
}
|
||||
@ -48,11 +49,14 @@ struct NavigationBarSettingsView: View {
|
||||
isPresented: $showItemPicker,
|
||||
selectedItems: $content.settings.navigation.navigationItems)
|
||||
}
|
||||
.onChange(of: language) { oldValue, newValue in
|
||||
print("Language changed from \(oldValue) to \(newValue)")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
NavigationBarSettingsView()
|
||||
NavigationBarSettingsView(language: .constant(.english))
|
||||
.environmentObject(Content.mock)
|
||||
.padding()
|
||||
}
|
||||
|
Reference in New Issue
Block a user