added check for dismiss first responder
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
ff6182db75
commit
43ec6d0671
@ -261,6 +261,21 @@ public class BaseViewController<Component: UIView>: UIViewController, Initable ,
|
||||
loadCustomRotors()
|
||||
UIAccessibility.post(notification: .screenChanged, argument: component)
|
||||
}
|
||||
|
||||
if component.canBecomeFirstResponder {
|
||||
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
|
||||
tapGesture.cancelsTouchesInView = false // This allows the tap to pass through to other views.
|
||||
view.addGestureRecognizer(tapGesture)
|
||||
}
|
||||
}
|
||||
|
||||
@objc func dismissKeyboard(_ sender: UITapGestureRecognizer) {
|
||||
let location = sender.location(in: self.view)
|
||||
|
||||
// Check if the touch is outside the textView
|
||||
if !component.frame.contains(location) {
|
||||
component.resignFirstResponder()
|
||||
}
|
||||
}
|
||||
|
||||
func isViewHiddenByKeyboard(view: UIView, keyboardFrame: CGRect) -> Bool {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user