got width working correctly
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
a927be7517
commit
aeb620a8a1
@ -32,6 +32,7 @@ open class TextArea: EntryFieldBase {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Private Properties
|
// MARK: - Private Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
internal var maxWidthConstraint: NSLayoutConstraint?
|
||||||
internal var minWidthConstraint: NSLayoutConstraint?
|
internal var minWidthConstraint: NSLayoutConstraint?
|
||||||
internal var textViewHeightConstraint: NSLayoutConstraint?
|
internal var textViewHeightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
@ -152,9 +153,9 @@ open class TextArea: EntryFieldBase {
|
|||||||
open override func setup() {
|
open override func setup() {
|
||||||
super.setup()
|
super.setup()
|
||||||
fieldStackView.pinToSuperView(.uniform(VDSFormControls.spaceInset))
|
fieldStackView.pinToSuperView(.uniform(VDSFormControls.spaceInset))
|
||||||
minWidthConstraint = containerView.widthAnchor.constraint(greaterThanOrEqualToConstant: containerSize.width)
|
minWidthConstraint = containerView.widthGreaterThanEqualTo(constant: containerSize.width)
|
||||||
minWidthConstraint?.isActive = true
|
maxWidthConstraint = containerView.width(constant: containerSize.width)
|
||||||
|
|
||||||
textView.isScrollEnabled = true
|
textView.isScrollEnabled = true
|
||||||
textView.autocorrectionType = .no
|
textView.autocorrectionType = .no
|
||||||
|
|
||||||
@ -184,6 +185,11 @@ open class TextArea: EntryFieldBase {
|
|||||||
borderColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .focused)
|
borderColorConfiguration.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forState: .focused)
|
||||||
characterCounterLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
|
characterCounterLabel.textColorConfiguration = primaryColorConfiguration.eraseToAnyColorable()
|
||||||
bottomContainerStackView.spacing = VDSLayout.space2X
|
bottomContainerStackView.spacing = VDSLayout.space2X
|
||||||
|
|
||||||
|
widthConstraint?.isActive = false
|
||||||
|
minWidthConstraint?.isActive = true
|
||||||
|
maxWidthConstraint?.isActive = true
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Resets to default settings.
|
/// Resets to default settings.
|
||||||
@ -203,15 +209,8 @@ open class TextArea: EntryFieldBase {
|
|||||||
textView.surface = surface
|
textView.surface = surface
|
||||||
|
|
||||||
//set the width constraints
|
//set the width constraints
|
||||||
if let width {
|
minWidthConstraint?.constant = containerSize.width
|
||||||
widthConstraint?.constant = width
|
maxWidthConstraint?.constant = frame.width
|
||||||
widthConstraint?.isActive = true
|
|
||||||
minWidthConstraint?.isActive = false
|
|
||||||
} else {
|
|
||||||
minWidthConstraint?.constant = containerSize.width
|
|
||||||
widthConstraint?.isActive = false
|
|
||||||
minWidthConstraint?.isActive = true
|
|
||||||
}
|
|
||||||
|
|
||||||
characterCounterLabel.text = getCharacterCounterText()
|
characterCounterLabel.text = getCharacterCounterText()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user