Fix back button not selecting settings item
Some checks are pending
Deploy Docs / publish (push) Waiting to run
SwiftLint / SwiftLint (push) Successful in 6s

This commit is contained in:
david-swift 2024-11-11 05:57:20 +01:00
parent c44ba521e2
commit ba5c0a97c5

View File

@ -155,7 +155,7 @@ public struct NavigationView<Item>: WinUIWidget where Item: NavigationViewItem {
if selectedItem != .custom(item: item) {
selectedItem = .custom(item: item)
}
} else {
} else if selectedItem != .settings {
selectedItem = .settings
}
}
@ -205,7 +205,7 @@ public struct NavigationView<Item>: WinUIWidget where Item: NavigationViewItem {
navigationView.paneDisplayMode = mode.winMode
}
if case .settings = selectedItem {
navigationView.isSettingsVisible = true
navigationView.selectedItem = navigationView.settingsItem
} else if case let .custom(name) = selectedItem {
navigationView.selectedItem = navigationView.menuItems
.first { ($0 as? WinUI.NavigationViewItem)?.name as? String == name.description } as Any?