diff --git a/nativescript-core/ui/text-base/text-base.ios.ts b/nativescript-core/ui/text-base/text-base.ios.ts index fa36b9f8a..45689d4fa 100644 --- a/nativescript-core/ui/text-base/text-base.ios.ts +++ b/nativescript-core/ui/text-base/text-base.ios.ts @@ -142,13 +142,7 @@ export class TextBase extends TextBaseCommon { } [colorProperty.setNative](value: Color | UIColor) { const color = value instanceof Color ? value.ios : value; - const nativeView = this.nativeTextViewProtected; - if (nativeView instanceof UIButton) { - nativeView.setTitleColorForState(color, UIControlState.Normal); - nativeView.titleLabel.textColor = color; - } else { - nativeView.textColor = color; - } + this._setColor(color); } [fontInternalProperty.getDefault](): UIFont { @@ -221,6 +215,16 @@ export class TextBase extends TextBaseCommon { } } + _setColor(color: UIColor): void { + const nativeView = this.nativeTextViewProtected; + if (nativeView instanceof UIButton) { + nativeView.setTitleColorForState(color, UIControlState.Normal); + nativeView.titleLabel.textColor = color; + } else { + nativeView.textColor = color; + } + } + setFormattedTextDecorationAndTransform() { const attrText = this.createNSMutableAttributedString(this.formattedText); // TODO: letterSpacing should be applied per Span. @@ -339,6 +343,10 @@ export class TextBase extends TextBaseCommon { this.nativeTextViewProtected.text = source; } } + + if (!style.color && majorVersion >= 13 && UIColor.labelColor) { + this._setColor(UIColor.labelColor); + } } createNSMutableAttributedString(formattedString: FormattedString): NSMutableAttributedString {