diff --git a/CrossPlatformModules.csproj b/CrossPlatformModules.csproj index 49368131a..cd1bee5b7 100644 --- a/CrossPlatformModules.csproj +++ b/CrossPlatformModules.csproj @@ -1666,7 +1666,13 @@ builder.d.ts - + + text-base.d.ts + + + text-base.d.ts + + text-base.d.ts @@ -2201,7 +2207,7 @@ False - + \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 96cfeb828..83fbd385a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -659,11 +659,13 @@ "ui/tab-view/tab-view.android.ts", "ui/tab-view/tab-view.d.ts", "ui/tab-view/tab-view.ios.ts", + "ui/text-base/text-base-common.ts", "ui/text-base/text-base-styler.android.ts", "ui/text-base/text-base-styler.d.ts", "ui/text-base/text-base-styler.ios.ts", + "ui/text-base/text-base.android.ts", "ui/text-base/text-base.d.ts", - "ui/text-base/text-base.ts", + "ui/text-base/text-base.ios.ts", "ui/text-field/text-field-common.ts", "ui/text-field/text-field.android.ts", "ui/text-field/text-field.d.ts", diff --git a/ui/button/button-common.ts b/ui/button/button-common.ts index 6a8ff535f..9fa53965c 100644 --- a/ui/button/button-common.ts +++ b/ui/button/button-common.ts @@ -99,41 +99,22 @@ export class Button extends view.View implements definition.Button { } private onFormattedTextChanged(eventData: observable.PropertyChangeData) { - this.setFormattedTextPropertyToNative(eventData.value); + this._setFormattedTextPropertyToNative(eventData.value); } public _onTextPropertyChanged(data: dependencyObservable.PropertyChangeData) { - if (this.android) { - this.android.setText(data.newValue + ""); - } - if (this.ios) { - // In general, if a property is not specified for a state, the default is to use - // the UIControlStateNormal value. If the value for UIControlStateNormal is not set, - // then the property defaults to a system value. Therefore, at a minimum, you should - // set the value for the normal state. - this.ios.setTitleForState(data.newValue + "", UIControlState.UIControlStateNormal); - } + // } - private setFormattedTextPropertyToNative(value) { - if (this.android) { - this.android.setText(value._formattedText); - } - if (this.ios) { - // In general, if a property is not specified for a state, the default is to use - // the UIControlStateNormal value. If the value for UIControlStateNormal is not set, - // then the property defaults to a system value. Therefore, at a minimum, you should - // set the value for the normal state. - this.ios.setAttributedTitleForState(value._formattedText, UIControlState.UIControlStateNormal); - this.style._updateTextDecoration(); - } + public _setFormattedTextPropertyToNative(value) { + // } public _onFormattedTextPropertyChanged(data: dependencyObservable.PropertyChangeData) { if (data.newValue) { (data.newValue).parent = this; } - this.setFormattedTextPropertyToNative(data.newValue); + this._setFormattedTextPropertyToNative(data.newValue); } public _addChildFromBuilder(name: string, value: any): void { diff --git a/ui/button/button.android.ts b/ui/button/button.android.ts index 3a98dd718..a32a7edee 100644 --- a/ui/button/button.android.ts +++ b/ui/button/button.android.ts @@ -1,5 +1,6 @@ import common = require("./button-common"); import utils = require("utils/utils") +import dependencyObservable = require("ui/core/dependency-observable"); global.moduleMerge(common, exports); @@ -36,4 +37,16 @@ export class Button extends common.Button { } })); } + + public _onTextPropertyChanged(data: dependencyObservable.PropertyChangeData) { + if (this.android) { + this.android.setText(data.newValue + ""); + } + } + + public _setFormattedTextPropertyToNative(value) { + if (this.android) { + this.android.setText(value._formattedText); + } + } } diff --git a/ui/button/button.d.ts b/ui/button/button.d.ts index 1d4229ed7..6c2db175e 100644 --- a/ui/button/button.d.ts +++ b/ui/button/button.d.ts @@ -71,5 +71,10 @@ declare module "ui/button" { * @param value - Value of the element. */ _addChildFromBuilder(name: string, value: any): void; + + //@private + _onTextPropertyChanged(data: dependencyObservable.PropertyChangeData): void; + _setFormattedTextPropertyToNative(value: any): void; + //@endprivate } } diff --git a/ui/button/button.ios.ts b/ui/button/button.ios.ts index 414d0035c..7fa02376e 100644 --- a/ui/button/button.ios.ts +++ b/ui/button/button.ios.ts @@ -5,6 +5,7 @@ import font = require("ui/styling/font"); import view = require("ui/core/view"); import utils = require("utils/utils"); import enums = require("ui/enums"); +import dependencyObservable = require("ui/core/dependency-observable"); class TapHandlerImpl extends NSObject { private _owner: WeakRef