| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,18 @@ | |||
| 1 | + import { NavigatedData } from "tns-core-modules/ui/page"; | ||
| 2 | + import { Page } from "tns-core-modules/ui/page"; | ||
| 3 | + import { Observable } from "tns-core-modules/data/observable"; | ||
| 4 | + | ||
| 5 | + export class HomeViewModel extends Observable { | ||
| 6 | + public stringValue = "test"; | ||
| 7 | + public stringNumericValue = "12345"; | ||
| 8 | + public numericValue = 12345; | ||
| 9 | + | ||
| 10 | + constructor() { | ||
| 11 | + super(); | ||
| 12 | + } | ||
| 13 | + } | ||
| 14 | + | ||
| 15 | + export function onNavigatingTo(args: NavigatedData) { | ||
| 16 | + const page = <Page>args.object; | ||
| 17 | + page.bindingContext = new HomeViewModel(); | ||
| 18 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,16 @@ | |||
| 1 | + <Page xmlns="http://schemas.nativescript.org/tns.xsd" id="main-page" navigatingTo="onNavigatingTo"> | ||
| 2 | + <StackLayout> | ||
| 3 | + <Label text="string value:" /> | ||
| 4 | + <Label text="{{ stringValue }}" /> | ||
| 5 | + <Label text="string value with uppercase:" /> | ||
| 6 | + <Label textTransform="uppercase" text="{{ stringValue }}" /> | ||
| 7 | + <Label text="string numeric value:" /> | ||
| 8 | + <Label text="{{ stringNumericValue }}" /> | ||
| 9 | + <Label text="string numeric value with uppercase:" /> | ||
| 10 | + <Label textTransform="uppercase" text="{{ stringNumericValue }}" /> | ||
| 11 | + <Label text="numeric value:" /> | ||
| 12 | + <Label text="{{ numericValue }}" /> | ||
| 13 | + <Label text="numeric value with uppercase:" /> | ||
| 14 | + <Label textTransform="uppercase" text="{{ numericValue }}" /> | ||
| 15 | + </StackLayout> | ||
| 16 | + </Page> | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -26,6 +26,7 @@ export function loadExamples() { | |||
| 26 | 26 | examples.set("tabview-with-scrollview_4022", "issues/tabview-with-scrollview_4022"); | |
| 27 | 27 | examples.set("3354-ios", "issues/issue-3354"); | |
| 28 | 28 | examples.set("4450", "issues/issue-4450"); | |
| 29 | + examples.set("5125", "issues/issue-5125"); | ||
| 29 | 30 | examples.set("5274", "issues/issue-5274"); | |
| 30 | 31 | examples.set("ng-repo-1599", "issues/issue-ng-repo-1599"); | |
| 31 | 32 | examples.set("ng-repo-1626", "issues/issue-ng-repo-1626"); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,7 +36,9 @@ function initializeTextTransformation(): void { | |||
| 36 | 36 | return createSpannableStringBuilder(formattedText); | |
| 37 | 37 | } | |
| 38 | 38 | else { | |
| 39 | - return getTransformedText(this.textBase.text, this.textBase.textTransform); | ||
| 39 | + const text = this.textBase.text; | ||
| 40 | + const stringValue = (text === null || text === undefined) ? "" : text.toString(); | ||
| 41 | + return getTransformedText(stringValue, this.textBase.textTransform); | ||
| 40 | 42 | } | |
| 41 | 43 | } | |
| 42 | 44 | ||
@@ -133,7 +135,7 @@ export class TextBase extends TextBaseCommon { | |||
| 133 | 135 | ||
| 134 | 136 | if (spannableStringBuilder && nativeView instanceof android.widget.Button && | |
| 135 | 137 | !(nativeView.getTransformationMethod() instanceof TextTransformation)) { | |
| 136 | - // Replace Android Button's default transformation (in case the developer has not already specified a text-transform) method | ||
| 138 | + // Replace Android Button's default transformation (in case the developer has not already specified a text-transform) method | ||
| 137 | 139 | // with our transformation method which can handle formatted text. | |
| 138 | 140 | // Otherwise, the default tranformation method of the Android Button will overwrite and ignore our spannableStringBuilder. | |
| 139 | 141 | nativeView.setTransformationMethod(new TextTransformation(this)); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments