fixed password link bug
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
6ad9156e13
commit
d7fc65612f
@ -100,11 +100,11 @@ extension InputField {
|
||||
|
||||
func appendRules(_ inputField: InputField) {}
|
||||
|
||||
func textFieldDidBeginEditing(_ inputField: InputField, textField: UITextField) {
|
||||
}
|
||||
func textFieldDidBeginEditing(_ inputField: InputField, textField: UITextField) { }
|
||||
|
||||
func textFieldDidEndEditing(_ inputField: InputField, textField: UITextField) {
|
||||
}
|
||||
func textFieldDidEndEditing(_ inputField: InputField, textField: UITextField) {}
|
||||
|
||||
func textFieldDidChangeSelection(_ inputField: InputField, textField: UITextField) {}
|
||||
|
||||
func textField(_ inputField: InputField, textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
|
||||
return true
|
||||
|
||||
@ -48,6 +48,20 @@ extension InputField {
|
||||
minWidth = 62.0
|
||||
|
||||
super.updateView(inputField)
|
||||
|
||||
updateLink(inputField)
|
||||
}
|
||||
|
||||
func updateLink(_ inputField: InputField) {
|
||||
if let text = inputField.textField.text, !text.isEmpty {
|
||||
inputField.actionTextLink.isHidden = false
|
||||
} else {
|
||||
inputField.actionTextLink.isHidden = true
|
||||
}
|
||||
}
|
||||
|
||||
override func textFieldDidChangeSelection(_ inputField: InputField, textField: UITextField) {
|
||||
updateLink(inputField)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -173,17 +173,6 @@ open class InputField: EntryFieldBase {
|
||||
|
||||
textField.heightAnchor.constraint(equalToConstant: 20).isActive = true
|
||||
textField.delegate = self
|
||||
textField
|
||||
.textPublisher
|
||||
.sink { [weak self] newText in
|
||||
guard let self else { return }
|
||||
print("textPublisher newText: \(newText)")
|
||||
if self.fieldType.handler().validateOnChange {
|
||||
self.validate()
|
||||
}
|
||||
self.sendActions(for: .valueChanged)
|
||||
}.store(in: &subscribers)
|
||||
|
||||
stackView.addArrangedSubview(successLabel)
|
||||
stackView.setCustomSpacing(8, after: successLabel)
|
||||
|
||||
@ -338,6 +327,16 @@ extension InputField: UITextFieldDelegate {
|
||||
validate()
|
||||
}
|
||||
|
||||
public func textFieldDidChangeSelection(_ textField: UITextField) {
|
||||
fieldType.handler().textFieldDidChangeSelection(self, textField: textField)
|
||||
if fieldType.handler().validateOnChange {
|
||||
validate()
|
||||
} else {
|
||||
setNeedsUpdate()
|
||||
}
|
||||
sendActions(for: .valueChanged)
|
||||
}
|
||||
|
||||
public func textField(_ textField: UITextField, shouldChangeCharactersIn range: NSRange, replacementString string: String) -> Bool {
|
||||
return fieldType.handler().textField(self, textField: textField, shouldChangeCharactersIn: range, replacementString: string)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user