FIXES issue#1200 (#1297)

This commit is contained in:
sebnoumea 2023-06-26 20:45:45 +11:00 committed by GitHub
parent ffe9e7a714
commit 044d3b6b84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -97,6 +97,9 @@ struct SideBarView<Content: View>: View {
private var tabsView: some View {
ForEach(tabs) { tab in
Button {
//ensure keyboard is always dismissed when selecting a tab
hideKeyboard()
if tab == selectedTab {
popToRootTab = .other
DispatchQueue.main.asyncAfter(deadline: .now() + 0.01) {
@ -171,3 +174,10 @@ private struct SideBarIcon: View {
}
}
}
extension View {
func hideKeyboard() {
let resign = #selector(UIResponder.resignFirstResponder)
UIApplication.shared.sendAction(resign, to: nil, from: nil, for: nil)
}
}