diff --git a/e2e/ui-tests-app/app/test-page-main-view-model.ts b/e2e/ui-tests-app/app/test-page-main-view-model.ts index c66f9914b..d08f19026 100644 --- a/e2e/ui-tests-app/app/test-page-main-view-model.ts +++ b/e2e/ui-tests-app/app/test-page-main-view-model.ts @@ -23,7 +23,7 @@ export class TestPageMainViewModel extends Observable { console.log(" EXAMPLE: " + selectedExample); if (this._examples.has(selectedExample)) { this.navigateToExample(this._examples.get(selectedExample)); - } else if (selectedExample.indexOf("/") > 0) { + } else if (selectedExample && selectedExample.indexOf("/") > 0) { this.navigateToExample(selectedExample); } } diff --git a/nativescript-core/ui/text-base/text-base.android.ts b/nativescript-core/ui/text-base/text-base.android.ts index 808ac3f63..082e1061f 100644 --- a/nativescript-core/ui/text-base/text-base.android.ts +++ b/nativescript-core/ui/text-base/text-base.android.ts @@ -3,7 +3,7 @@ import { TextTransformation, TextDecoration, TextAlignment, TextTransform, White // Requires import { Font } from "../styling/font"; -import { backgroundColorProperty } from "../styling/style-properties"; +import { backgroundColorProperty, VerticalAlignment } from "../styling/style-properties"; import { TextBaseCommon, formattedTextProperty, textAlignmentProperty, textDecorationProperty, fontSizeProperty, textProperty, textTransformProperty, letterSpacingProperty, colorProperty, fontInternalProperty, @@ -444,9 +444,9 @@ function createSpannableStringBuilder(formattedString: FormattedString, defaultF class BaselineAdjustedSpan extends android.text.style.MetricAffectingSpan { fontSize: number; - align: string | number = "baseline"; + align: VerticalAlignment = "baseline"; - constructor(fontSize: number, align?: string | number) { + constructor(fontSize: number, align?: VerticalAlignment) { super(); this.align = align; @@ -464,7 +464,7 @@ class BaselineAdjustedSpan extends android.text.style.MetricAffectingSpan { updateState(paint: android.text.TextPaint) { const metrics = paint.getFontMetrics(); - if (!this.align || this.align === "baseline") { + if (!this.align || ["baseline", "stretch"].includes(this.align)) { return; } diff --git a/nativescript-core/ui/text-base/text-base.ios.ts b/nativescript-core/ui/text-base/text-base.ios.ts index 45689d4fa..1d83d1f59 100644 --- a/nativescript-core/ui/text-base/text-base.ios.ts +++ b/nativescript-core/ui/text-base/text-base.ios.ts @@ -3,6 +3,7 @@ import { TextDecoration, TextAlignment, TextTransform, layout, getClosestPropert // Requires import { Font } from "../styling/font"; +import { VerticalAlignment } from "../styling/style-properties"; import { TextBaseCommon, textProperty, formattedTextProperty, textAlignmentProperty, textDecorationProperty, textTransformProperty, letterSpacingProperty, colorProperty, fontInternalProperty, lineHeightProperty, @@ -216,12 +217,11 @@ 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; + if (this.nativeTextViewProtected instanceof UIButton) { + this.nativeTextViewProtected.setTitleColorForState(color, UIControlState.Normal); + this.nativeTextViewProtected.titleLabel.textColor = color; } else { - nativeView.textColor = color; + this.nativeTextViewProtected.textColor = color; } } @@ -286,7 +286,7 @@ export class TextBase extends TextBaseCommon { } if (style.letterSpacing !== 0 && this.nativeTextViewProtected.font) { - const kern = style.letterSpacing * this.nativeTextViewProtected.font.pointSize + const kern = style.letterSpacing * this.nativeTextViewProtected.font.pointSize; dict.set(NSKernAttributeName, kern); } @@ -372,8 +372,8 @@ export class TextBase extends TextBaseCommon { return mas; } - getBaselineOffset(font: UIFont, align?: string | number): number { - if (!align || align === "baseline") { + getBaselineOffset(font: UIFont, align?: VerticalAlignment): number { + if (!align || ["stretch", "baseline"].includes(align)) { return 0; }