Skip to content

Commit

Permalink
Merge pull request #532 from pennlabs/anli/subletting-keyboard
Browse files Browse the repository at this point in the history
Improve keyboard dismissing for subletting
  • Loading branch information
anli5005 authored Apr 14, 2024
2 parents 510f87c + 3bf41e6 commit 5480af9
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
5 changes: 5 additions & 0 deletions PennMobile/General/SwiftUI Views/CustomPopupView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ class PopupManager: ObservableObject {
}

public func show() {
if !isShown {
// https://www.hackingwithswift.com/quick-start/swiftui/how-to-dismiss-the-keyboard-for-a-textfield
UIApplication.shared.sendAction(#selector(UIResponder.resignFirstResponder), to: nil, from: nil, for: nil)
}

withAnimation {
self.isShown = true
}
Expand Down
1 change: 1 addition & 0 deletions PennMobile/Subletting/Listings/NewListingForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ struct NewListingForm: View {
}
}
}
.scrollDismissesKeyboard(.interactively)
}
}

Expand Down
1 change: 1 addition & 0 deletions PennMobile/Subletting/MarketplaceFilterView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ struct MarketplaceFilterView: View {
}
}
}
.scrollDismissesKeyboard(.interactively)
.navigationBarTitle(Text("Filter by"), displayMode: .inline)
.navigationBarItems(leading: Button(action: {
dismiss()
Expand Down
1 change: 1 addition & 0 deletions PennMobile/Subletting/SubletInterestForm.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ struct SubletInterestForm: View {
}
}
}
.scrollDismissesKeyboard(.interactively)
.navigationTitle("Send Interest")
}
}
Expand Down

0 comments on commit 5480af9

Please sign in to comment.