Changes as per Kyle comments on PR

This commit is contained in:
Sourabh Bhardwaj 2022-02-17 17:39:19 +05:30
parent 39e29bbaaf
commit c3eb895bdd

View File

@ -50,7 +50,6 @@ import UIKit
//--------------------------------------------------
private var observingForChange: Bool = false
private let emailTag = 3
/// Validate when user resigns editing. Default: true
public var validateWhenDoneEditing: Bool = true
@ -230,12 +229,7 @@ import UIKit
/// Validates the text of the entry field.
@objc public override func validateText() {
var value = textField.text
if (textField.tag == emailTag) {
// remove spaces (either user entered Or auto-correct suggestion) for the email field
value = value?.replacingOccurrences(of: " ", with: "")
}
text = value
text = textField.text
super.validateText()
}
@ -253,6 +247,10 @@ import UIKit
/// Executes on UITextField.textDidChangeNotification (each character entry)
@objc override func valueChanged() {
super.valueChanged()
if (textEntryFieldModel?.type == .email) {
// remove spaces (either user entered Or auto-correct suggestion) for the email field
textField.text = textField.text?.replacingOccurrences(of: " ", with: "")
}
validateText()
}
@ -353,7 +351,6 @@ import UIKit
case .email:
textField.keyboardType = .emailAddress
textField.tag = emailTag
case .phone:
textField.keyboardType = .phonePad