fixed other bugs for tab

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-08-22 17:10:02 -05:00
parent 90ac92144f
commit ee48532cce

View File

@ -97,7 +97,7 @@ extension Tabs {
private func updateWidth() { private func updateWidth() {
labelWidthConstraint?.isActive = false labelWidthConstraint?.isActive = false
guard let width else { return } guard let width, width > minWidth else { return }
labelWidthConstraint?.constant = width labelWidthConstraint?.constant = width
labelWidthConstraint?.isActive = true labelWidthConstraint?.isActive = true
} }
@ -138,7 +138,8 @@ extension Tabs {
label.pinTrailing(layoutGuide.trailingAnchor) label.pinTrailing(layoutGuide.trailingAnchor)
//setup constraints //setup constraints
labelWidthConstraint = label.width(constant: 0).with { $0.isActive = false } labelWidthConstraint = layoutGuide.width(constant: 0).with { $0.isActive = false }
layoutGuide.widthGreaterThanEqualTo(minWidth)
labelTopConstraint = label.pinTop(anchor: layoutGuide.topAnchor) labelTopConstraint = label.pinTop(anchor: layoutGuide.topAnchor)
labelLeadingConstraint = label.pinLeading(anchor: layoutGuide.leadingAnchor) labelLeadingConstraint = label.pinLeading(anchor: layoutGuide.leadingAnchor)
labelBottomConstraint = label.pinBottom(anchor: layoutGuide.bottomAnchor, priority: .defaultHigh) labelBottomConstraint = label.pinBottom(anchor: layoutGuide.bottomAnchor, priority: .defaultHigh)
@ -164,7 +165,6 @@ extension Tabs {
label.textStyle = textStyle label.textStyle = textStyle
label.textPosition = textPosition label.textPosition = textPosition
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable() label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
setNeedsLayout() setNeedsLayout()
layoutIfNeeded() layoutIfNeeded()