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