curent working order
This commit is contained in:
parent
4f3f52195e
commit
e90be283dc
@ -179,7 +179,22 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
|||||||
/// Validates the text of the entry field.
|
/// Validates the text of the entry field.
|
||||||
@objc public func validateTextField() {
|
@objc public func validateTextField() {
|
||||||
text = textView.text
|
text = textView.text
|
||||||
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
|
if let isValid = FormValidator.validate(delegate: delegateObject?.formHolderDelegate) {
|
||||||
|
self.isValid = isValid
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@objc public func updateValidation(_ isValid: Bool) {
|
||||||
|
let previousValidity = self.isValid
|
||||||
|
self.isValid = isValid
|
||||||
|
|
||||||
|
if previousValidity && !isValid {
|
||||||
|
// showError = true
|
||||||
|
// observingTextViewDelegate?.isInvalid?(textfield: self)
|
||||||
|
} else if (!previousValidity && isValid) {
|
||||||
|
// showError = false
|
||||||
|
// observingTextViewDelegate?.isValid?(textfield: self)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Executes on UITextField.textDidBeginEditingNotification
|
/// Executes on UITextField.textDidBeginEditingNotification
|
||||||
@ -241,9 +256,13 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
|||||||
|
|
||||||
self.textView.setPlaceholderIfAvailable()
|
self.textView.setPlaceholderIfAvailable()
|
||||||
isSelected = false
|
isSelected = false
|
||||||
|
|
||||||
if isValid {
|
if isValid {
|
||||||
showError = false
|
showError = false
|
||||||
entryFieldContainer.bottomBar?.backgroundColor = UIColor.mvmBlack.cgColor
|
entryFieldContainer.bottomBar?.backgroundColor = UIColor.mvmBlack.cgColor
|
||||||
|
} else {
|
||||||
|
showError = true
|
||||||
|
entryFieldContainer.disableAllBorders = false
|
||||||
}
|
}
|
||||||
proprietorTextDelegate?.textViewDidEndEditing?(textView)
|
proprietorTextDelegate?.textViewDidEndEditing?(textView)
|
||||||
}
|
}
|
||||||
@ -262,6 +281,16 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
|||||||
heightConstraint?.isActive = true
|
heightConstraint?.isActive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
model.updateUI = { [weak self] in
|
||||||
|
MVMCoreDispatchUtility.performBlock(onMainThread: {
|
||||||
|
guard let self = self else { return }
|
||||||
|
|
||||||
|
if self.isSelected {
|
||||||
|
self.updateValidation(model.isValid ?? true)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
text = model.text
|
text = model.text
|
||||||
uiTextViewDelegate = delegateObject?.uiTextViewDelegate
|
uiTextViewDelegate = delegateObject?.uiTextViewDelegate
|
||||||
|
|
||||||
|
|||||||
@ -19,7 +19,7 @@ import UIKit
|
|||||||
let layer = CAShapeLayer()
|
let layer = CAShapeLayer()
|
||||||
layer.backgroundColor = UIColor.mvmBlack.cgColor
|
layer.backgroundColor = UIColor.mvmBlack.cgColor
|
||||||
layer.drawsAsynchronously = true
|
layer.drawsAsynchronously = true
|
||||||
layer.anchorPoint = CGPoint(x: 0.5, y: 1.0);
|
layer.anchorPoint = CGPoint(x: 0.5, y: 1.0)
|
||||||
return layer
|
return layer
|
||||||
}()
|
}()
|
||||||
|
|
||||||
@ -140,7 +140,7 @@ import UIKit
|
|||||||
|
|
||||||
borderPath.removeAllPoints()
|
borderPath.removeAllPoints()
|
||||||
|
|
||||||
if !disableAllBorders && !hideBorders {
|
if (disableAllBorders && showError) || (!disableAllBorders && !hideBorders) {
|
||||||
// Brings the other half of the line inside the view to prevent cropping.
|
// Brings the other half of the line inside the view to prevent cropping.
|
||||||
let origin = bounds.origin
|
let origin = bounds.origin
|
||||||
let size = frame.size
|
let size = frame.size
|
||||||
@ -260,7 +260,7 @@ import UIKit
|
|||||||
|
|
||||||
open func refreshUI(bottomBarSize: CGFloat? = nil, updateMoleculeLayout: Bool = false) {
|
open func refreshUI(bottomBarSize: CGFloat? = nil, updateMoleculeLayout: Bool = false) {
|
||||||
|
|
||||||
if !disableAllBorders {
|
if !disableAllBorders || (disableAllBorders && showError) {
|
||||||
let size: CGFloat = bottomBarSize ?? (showError ? 4 : 1)
|
let size: CGFloat = bottomBarSize ?? (showError ? 4 : 1)
|
||||||
var heightChanged = false
|
var heightChanged = false
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user