Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix FXIOS-10696 Dismiss search bar when tap on the outside view in HistoryPanel #23276

Merged
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class HistoryPanel: UIViewController,
setupLayout()
configureDataSource()
applyTheme()

setupSearchBarTapGesture()
// Update theme of already existing view
bottomStackView.applyTheme(theme: currentTheme())
}
Expand Down Expand Up @@ -862,10 +862,24 @@ extension HistoryPanel {
}
}
}

private func setupSearchBarTapGesture() {
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(removedSearchBarWhenTapOutside))
tapGesture.cancelsTouchesInView = false
view.addGestureRecognizer(tapGesture)
}
}

// MARK: - User action helpers
extension HistoryPanel {
@objc
private func removedSearchBarWhenTapOutside(_ sender: UITapGestureRecognizer) {
if !bottomStackView.isHidden && !bottomStackView.frame.contains(sender.location(in: view)) {
bottomStackView.isHidden = true
searchbar.resignFirstResponder()
}
}

func handleLeftTopButton() {
updatePanelState(newState: .history(state: .mainView))
}
Expand Down