fixing bug where textfield was not being recognized when resigning responder.
This commit is contained in:
parent
4ff660accc
commit
61a5932a88
@ -21,7 +21,7 @@ import UIKit
|
||||
let caret = CaretView()
|
||||
caret.direction = .down
|
||||
caret.lineWidth = 1.5
|
||||
caret.isUserInteractionEnabled = true
|
||||
caret.isUserInteractionEnabled = false
|
||||
caret.heightAnchor.constraint(equalToConstant: 9).isActive = true
|
||||
caret.widthAnchor.constraint(equalToConstant: 16).isActive = true
|
||||
return caret
|
||||
|
||||
@ -25,7 +25,7 @@ import UIKit
|
||||
//--------------------------------------------------
|
||||
|
||||
open private(set) var textField: TextField = {
|
||||
let textField = TextField(frame: .zero)
|
||||
let textField = TextField()
|
||||
textField.isAccessibilityElement = true
|
||||
textField.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
textField.font = MFStyler.fontForTextField()
|
||||
@ -58,7 +58,7 @@ import UIKit
|
||||
get { return super.isEnabled }
|
||||
set (enabled) {
|
||||
super.isEnabled = enabled
|
||||
|
||||
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
guard let self = self else { return }
|
||||
|
||||
@ -99,7 +99,7 @@ import UIKit
|
||||
//--------------------------------------------------
|
||||
|
||||
public var validationBlock: ((_ value: String?) -> Bool)?
|
||||
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Delegate Properties
|
||||
//--------------------------------------------------
|
||||
@ -169,6 +169,9 @@ import UIKit
|
||||
textFieldTrailingConstraint = container.trailingAnchor.constraint(equalTo: textField.trailingAnchor, constant: 16)
|
||||
textFieldTrailingConstraint?.isActive = true
|
||||
|
||||
textField.addTarget(self, action: #selector(startEditing), for: .editingDidBegin)
|
||||
textField.addTarget(self, action: #selector(dismissFieldInput(_:)), for: .editingDidEnd)
|
||||
|
||||
let tap = UITapGestureRecognizer(target: self, action: #selector(startEditing))
|
||||
entryFieldContainer.addGestureRecognizer(tap)
|
||||
|
||||
@ -225,7 +228,7 @@ import UIKit
|
||||
/// Validates the text of the entry field.
|
||||
@discardableResult
|
||||
@objc public func validateTextField() -> Bool {
|
||||
|
||||
|
||||
isValid = validationBlock?(text) ?? true
|
||||
|
||||
if isValid {
|
||||
@ -277,7 +280,7 @@ import UIKit
|
||||
guard let model = model as? TextEntryFieldModel else { return }
|
||||
|
||||
FormValidator.setupValidation(molecule: self, delegate: delegateObject?.formValidationProtocol)
|
||||
|
||||
|
||||
textColor.enabled = model.enabledTextColor?.uiColor
|
||||
textColor.disabled = model.disabledTextColor?.uiColor
|
||||
text = model.text
|
||||
|
||||
Loading…
Reference in New Issue
Block a user