reorientation
This commit is contained in:
parent
c913b98aa5
commit
e6c0145efa
@ -69,11 +69,7 @@ import UIKit
|
||||
get { return entryFieldContainer.showError }
|
||||
set (error) {
|
||||
self.feedback = error ? entryFieldModel?.errorMessage : entryFieldModel?.feedback
|
||||
if error {
|
||||
feedbackLabel.textColor = entryFieldModel?.errorTextColor?.uiColor ?? .mvmBlack
|
||||
} else {
|
||||
feedbackLabel.textColor = .mvmBlack
|
||||
}
|
||||
self.feedbackLabel.textColor = error ? entryFieldModel?.errorTextColor?.uiColor ?? .mvmBlack : .mvmBlack
|
||||
self.entryFieldContainer.showError = error
|
||||
self.entryFieldModel?.showError = error
|
||||
}
|
||||
|
||||
@ -222,7 +222,6 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
||||
|
||||
@objc public func textViewDidBeginEditing(_ textView: UITextView) {
|
||||
|
||||
self.textView.setTextAppearance()
|
||||
isSelected = true
|
||||
proprietorTextDelegate?.textViewDidBeginEditing?(textView)
|
||||
}
|
||||
@ -244,8 +243,7 @@ class TextViewEntryField: EntryField, UITextViewDelegate, ObservingTextFieldDele
|
||||
}
|
||||
|
||||
@objc public func textViewDidEndEditing(_ textView: UITextView) {
|
||||
|
||||
self.textView.setPlaceholderIfAvailable()
|
||||
|
||||
isSelected = false
|
||||
|
||||
if isValid {
|
||||
|
||||
@ -31,7 +31,6 @@ class TextViewEntryFieldModel: TextEntryFieldModel {
|
||||
//--------------------------------------------------
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case text
|
||||
case accessibilityText
|
||||
case fontStyle
|
||||
case height
|
||||
@ -60,6 +59,10 @@ class TextViewEntryFieldModel: TextEntryFieldModel {
|
||||
self.fontStyle = fontStyle
|
||||
}
|
||||
|
||||
if let editable = try typeContainer.decodeIfPresent(Bool.self, forKey: .editable) {
|
||||
self.editable = editable
|
||||
}
|
||||
|
||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||
height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height)
|
||||
}
|
||||
@ -70,7 +73,7 @@ class TextViewEntryFieldModel: TextEntryFieldModel {
|
||||
try container.encodeIfPresent(accessibilityText, forKey: .accessibilityText)
|
||||
try container.encodeIfPresent(height, forKey: .height)
|
||||
try container.encode(fontStyle, forKey: .fontStyle)
|
||||
try container.encode(text, forKey: .text)
|
||||
try container.encode(editable, forKey: .editable)
|
||||
try container.encode(placeholderFontStyle, forKey: .placeholderFontStyle)
|
||||
try container.encode(placeholderTextColor, forKey: .placeholderTextColor)
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ import UIKit
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Methods
|
||||
// MARK: - TextInputDidDeleteProtocol
|
||||
//--------------------------------------------------
|
||||
|
||||
/// Alters the blinking caret line as per design standards.
|
||||
@ -138,11 +138,22 @@ import UIKit
|
||||
didDeleteDelegate?.textInputDidDelete()
|
||||
}
|
||||
|
||||
public func setTextAppearance() {
|
||||
//--------------------------------------------------
|
||||
// MARK: - Text / Placeholder
|
||||
//--------------------------------------------------
|
||||
|
||||
open override func becomeFirstResponder() -> Bool {
|
||||
|
||||
if isShowingPlaceholder {
|
||||
setTextContentTraits()
|
||||
}
|
||||
return super.becomeFirstResponder()
|
||||
}
|
||||
|
||||
open override func resignFirstResponder() -> Bool {
|
||||
|
||||
setPlaceholderIfAvailable()
|
||||
return super.resignFirstResponder()
|
||||
}
|
||||
|
||||
public func setPlaceholderIfAvailable() {
|
||||
@ -152,7 +163,7 @@ import UIKit
|
||||
}
|
||||
}
|
||||
|
||||
public func setTextContentTraits() {
|
||||
open func setTextContentTraits() {
|
||||
|
||||
isShowingPlaceholder = false
|
||||
text = ""
|
||||
@ -160,7 +171,7 @@ import UIKit
|
||||
textColor = .mvmBlack
|
||||
}
|
||||
|
||||
public func setPlaceholderContentTraits() {
|
||||
open func setPlaceholderContentTraits() {
|
||||
|
||||
isShowingPlaceholder = true
|
||||
textColor = placeholderTextColor
|
||||
@ -168,8 +179,8 @@ import UIKit
|
||||
text = placeholder
|
||||
}
|
||||
|
||||
@objc func dismissFieldInput(_ sender: TextView) {
|
||||
@objc open func dismissFieldInput(_ sender: TextView) {
|
||||
|
||||
resignFirstResponder()
|
||||
_ = resignFirstResponder()
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user