show error on end editing
This commit is contained in:
parent
54e1a6f9db
commit
89c6204003
@ -244,14 +244,21 @@ import UIKit
|
||||
self.isValid = isValid
|
||||
|
||||
if previousValidity && !isValid {
|
||||
showError = true
|
||||
observingTextFieldDelegate?.isInvalid?(textfield: self)
|
||||
shouldShowError(true)
|
||||
} else if (!previousValidity && isValid) {
|
||||
showError = false
|
||||
observingTextFieldDelegate?.isValid?(textfield: self)
|
||||
shouldShowError(false)
|
||||
}
|
||||
}
|
||||
|
||||
func shouldShowError(_ showError: Bool) {
|
||||
self.showError = showError
|
||||
if showError {
|
||||
observingTextFieldDelegate?.isValid?(textfield: self)
|
||||
entryFieldContainer.bottomBar?.backgroundColor = UIColor.mvmBlack.cgColor
|
||||
} else {
|
||||
observingTextFieldDelegate?.isInvalid?(textfield: self)
|
||||
}
|
||||
}
|
||||
|
||||
/// Executes on UITextField.textDidBeginEditingNotification
|
||||
@objc func startEditing() {
|
||||
isSelected = true
|
||||
@ -268,10 +275,16 @@ import UIKit
|
||||
/// Executes on UITextField.textDidEndEditingNotification
|
||||
@objc func endInputing() {
|
||||
resignFirstResponder()
|
||||
if isValid {
|
||||
showError = false
|
||||
entryFieldContainer.bottomBar?.backgroundColor = UIColor.mvmBlack.cgColor
|
||||
|
||||
// If user did not enter text int ethe field dont show error yet.
|
||||
if text?.count ?? 0 == 0{
|
||||
return
|
||||
}
|
||||
|
||||
if let isValid = (model as? TextEntryFieldModel)?.isValid {
|
||||
self.isValid = isValid
|
||||
}
|
||||
shouldShowError(!isValid)
|
||||
}
|
||||
|
||||
@objc public func dismissFieldInput(_ sender: Any?) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user