mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
TextBase and Button text-decoration and text-transform fixes
This commit is contained in:
@ -4,6 +4,20 @@ import button = require("ui/button");
|
||||
import textField = require("ui/text-field");
|
||||
import textView = require("ui/text-view");
|
||||
|
||||
export function changeTextButonTap(args) {
|
||||
var btnChange = <button.Button>args.object;
|
||||
var lbl = <label.Label>btnChange.parent.getViewById("Label");
|
||||
var btn = <button.Button>btnChange.parent.getViewById("Button");
|
||||
var textField = <textField.TextField>btnChange.parent.getViewById("TextField");
|
||||
var textView = <textView.TextView>btnChange.parent.getViewById("TextView");
|
||||
|
||||
if(lbl.text === "Change text") {
|
||||
lbl.text = btn.text = textField.text = textView.text = "Text changed";
|
||||
} else {
|
||||
lbl.text = btn.text = textField.text = textView.text = "Change text";
|
||||
}
|
||||
}
|
||||
|
||||
export function butonTap(args) {
|
||||
var btnChange = <view.View>args.object;
|
||||
var lbl = <label.Label>btnChange.parent.getViewById("Label");
|
||||
|
@ -1,5 +1,6 @@
|
||||
<Page >
|
||||
<StackLayout>
|
||||
<Button id="ChangeText" automationText="Change text" text="Change text" tap="changeTextButonTap" />
|
||||
<Button id="Change" automationText="Change" text="Change" tap="butonTap" />
|
||||
<Label id="Label" automationText="Label" text="Label" style.textDecoration="none" />
|
||||
<Button id="Button" automationText="Button" text="Button" style.textDecoration="none" />
|
||||
|
@ -4,6 +4,20 @@ import button = require("ui/button");
|
||||
import textField = require("ui/text-field");
|
||||
import textView = require("ui/text-view");
|
||||
|
||||
export function changeTextButonTap(args) {
|
||||
var btnChange = <button.Button>args.object;
|
||||
var lbl = <label.Label>btnChange.parent.getViewById("Label");
|
||||
var btn = <button.Button>btnChange.parent.getViewById("Button");
|
||||
var textField = <textField.TextField>btnChange.parent.getViewById("TextField");
|
||||
var textView = <textView.TextView>btnChange.parent.getViewById("TextView");
|
||||
|
||||
if(lbl.text === "Change text") {
|
||||
lbl.text = btn.text = textField.text = textView.text = "Text changed";
|
||||
} else {
|
||||
lbl.text = btn.text = textField.text = textView.text = "Change text";
|
||||
}
|
||||
}
|
||||
|
||||
export function butonTap(args) {
|
||||
var btnChange = <view.View>args.object;
|
||||
var lbl = <label.Label>btnChange.parent.getViewById("Label");
|
||||
|
@ -1,5 +1,6 @@
|
||||
<Page >
|
||||
<StackLayout>
|
||||
<Button id="ChangeText" automationText="Change text" text="Change text" tap="changeTextButonTap" />
|
||||
<Button id="Change" automationText="Change" text="Change" tap="butonTap" />
|
||||
<Label id="Label" automationText="Label" text="label Label" style.textTransform="none" />
|
||||
<Button id="Button" automationText="Button" text="button Button" style.textTransform="none" />
|
||||
|
@ -25,16 +25,20 @@ var textProperty = new dependencyObservable.Property(
|
||||
"text",
|
||||
"Button",
|
||||
new proxy.PropertyMetadata("", dependencyObservable.PropertyMetadataSettings.AffectsLayout)
|
||||
);
|
||||
);
|
||||
|
||||
var formattedTextProperty = new dependencyObservable.Property(
|
||||
"formattedText",
|
||||
"Button",
|
||||
new proxy.PropertyMetadata("", dependencyObservable.PropertyMetadataSettings.AffectsLayout)
|
||||
);
|
||||
);
|
||||
|
||||
function onTextPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
||||
var button = <Button>data.object;
|
||||
|
||||
button.style._updateTextDecoration();
|
||||
button.style._updateTextTransform();
|
||||
|
||||
button._onTextPropertyChanged(data);
|
||||
}
|
||||
|
||||
@ -63,6 +67,9 @@ export class Button extends view.View implements definition.Button {
|
||||
if (this.formattedText) {
|
||||
this.formattedText.updateSpansBindingContext(newValue);
|
||||
}
|
||||
|
||||
this.style._updateTextDecoration();
|
||||
this.style._updateTextTransform();
|
||||
}
|
||||
|
||||
get text(): string {
|
||||
|
@ -18,16 +18,20 @@ var textProperty = new dependencyObservable.Property(
|
||||
"text",
|
||||
"TextBase",
|
||||
new proxy.PropertyMetadata("", dependencyObservable.PropertyMetadataSettings.AffectsLayout)
|
||||
);
|
||||
);
|
||||
|
||||
var formattedTextProperty = new dependencyObservable.Property(
|
||||
"formattedText",
|
||||
"TextBase",
|
||||
new proxy.PropertyMetadata("", dependencyObservable.PropertyMetadataSettings.AffectsLayout)
|
||||
);
|
||||
);
|
||||
|
||||
function onTextPropertyChanged(data: dependencyObservable.PropertyChangeData) {
|
||||
var textBase = <TextBase>data.object;
|
||||
|
||||
textBase.style._updateTextTransform();
|
||||
textBase.style._updateTextDecoration();
|
||||
|
||||
textBase._onTextPropertyChanged(data);
|
||||
}
|
||||
|
||||
@ -53,7 +57,7 @@ export class TextBase extends view.View implements definition.TextBase, formatte
|
||||
if (this.formattedText) {
|
||||
this.formattedText.updateSpansBindingContext(newValue);
|
||||
}
|
||||
|
||||
|
||||
this.style._updateTextTransform();
|
||||
this.style._updateTextDecoration();
|
||||
}
|
||||
|
@ -142,6 +142,9 @@ export class TextField extends common.TextField {
|
||||
public onLoaded() {
|
||||
super.onLoaded();
|
||||
this._ios.delegate = this._delegate;
|
||||
|
||||
this.style._updateTextDecoration();
|
||||
this.style._updateTextTransform();
|
||||
}
|
||||
|
||||
public onUnloaded() {
|
||||
|
@ -83,6 +83,9 @@ export class TextView extends common.TextView {
|
||||
public onLoaded() {
|
||||
super.onLoaded();
|
||||
this._ios.delegate = this._delegate;
|
||||
|
||||
this.style._updateTextDecoration();
|
||||
this.style._updateTextTransform();
|
||||
}
|
||||
|
||||
public onUnloaded() {
|
||||
|
Reference in New Issue
Block a user