Skip to content

Commit

Permalink
In PDFSearchViewController dismiss keyboard on search button click
Browse files Browse the repository at this point in the history
  • Loading branch information
mvasilak committed Feb 26, 2024
1 parent 9b08d69 commit 8405eeb
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Zotero/Scenes/Detail/PDF/Views/PDFSearchViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ final class PDFSearchViewController: UIViewController {
let searchBar = UISearchBar()
searchBar.translatesAutoresizingMaskIntoConstraints = false
searchBar.placeholder = L10n.Pdf.Search.title
// Set search bar delegate before reactive extension, otherwise reactive will be overwritten.
searchBar.delegate = self
searchBar.rx
.text
.observe(on: MainScheduler.instance)
Expand Down Expand Up @@ -202,3 +204,9 @@ extension PDFSearchViewController: TextSearchDelegate {
searchBar.isLoading = false
}
}

extension PDFSearchViewController: UISearchBarDelegate {
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
searchBar.resignFirstResponder()
}
}

0 comments on commit 8405eeb

Please sign in to comment.