From 0ca838ed0ced845b5a02300d31cbd1256e597a9d Mon Sep 17 00:00:00 2001 From: Nathan Walker Date: Wed, 17 Jun 2020 11:07:38 -0700 Subject: [PATCH] fix(span): value handling for strings and numbers (#8651) closes https://github.com/NativeScript/NativeScript/issues/8647 --- nativescript-core/ui/text-base/span.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nativescript-core/ui/text-base/span.ts b/nativescript-core/ui/text-base/span.ts index e2a648a34..afce37d80 100644 --- a/nativescript-core/ui/text-base/span.ts +++ b/nativescript-core/ui/text-base/span.ts @@ -65,8 +65,9 @@ export class Span extends ViewBase implements SpanDefinition { } set text(value: string) { if (this._text !== value) { - this._text = value && value.replace("\\n", "\n").replace("\\t", "\t"); - this.notifyPropertyChange("text", value); + // value can be a number + this._text = `${value}`.replace("\\n", "\n").replace("\\t", "\t"); + this.notifyPropertyChange("text", this._text); } }