mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
TransformationMethod set to null in order to apply formattedText
This commit is contained in:
@ -12,6 +12,16 @@
|
||||
</FormattedString>
|
||||
</Label.formattedText>
|
||||
</Label>
|
||||
<Label>
|
||||
<Label.formattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.spans>
|
||||
<Span text="label" fontAttributes="Bold" foregroundColor="#0000ff" />
|
||||
<Span text="Label" fontAttributes="Italic" foregroundColor="#00ff00" />
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</Label.formattedText>
|
||||
</Label>
|
||||
|
||||
<Button text="buttonButton" style="text-transform: uppercase; text-decoration: underline line-through;" />
|
||||
<Button style="text-transform: uppercase; text-decoration: underline line-through;">
|
||||
@ -24,6 +34,16 @@
|
||||
</FormattedString>
|
||||
</Button.formattedText>
|
||||
</Button>
|
||||
<Button>
|
||||
<Button.formattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.spans>
|
||||
<Span text="button" fontAttributes="Bold" foregroundColor="#0000ff" />
|
||||
<Span text="Button" fontAttributes="Italic" foregroundColor="#00ff00" />
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</Button.formattedText>
|
||||
</Button>
|
||||
|
||||
<TextField text="textField" style="text-transform: uppercase; text-decoration: underline line-through;" />
|
||||
<TextField style="text-transform: uppercase; text-decoration: underline line-through;">
|
||||
@ -36,6 +56,16 @@
|
||||
</FormattedString>
|
||||
</TextField.formattedText>
|
||||
</TextField>
|
||||
<TextField>
|
||||
<TextField.formattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.spans>
|
||||
<Span text="text" fontAttributes="Bold" foregroundColor="#0000ff" />
|
||||
<Span text="Field" fontAttributes="Italic" foregroundColor="#00ff00" />
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</TextField.formattedText>
|
||||
</TextField>
|
||||
|
||||
<TextView text="textView" style="text-transform: uppercase; text-decoration: underline line-through;" />
|
||||
<TextView style="text-transform: uppercase; text-decoration: underline line-through;">
|
||||
@ -48,6 +78,16 @@
|
||||
</FormattedString>
|
||||
</TextView.formattedText>
|
||||
</TextView>
|
||||
<TextView>
|
||||
<TextView.formattedText>
|
||||
<FormattedString>
|
||||
<FormattedString.spans>
|
||||
<Span text="text" fontAttributes="Bold" foregroundColor="#0000ff" />
|
||||
<Span text="View" fontAttributes="Italic" foregroundColor="#00ff00" />
|
||||
</FormattedString.spans>
|
||||
</FormattedString>
|
||||
</TextView.formattedText>
|
||||
</TextView>
|
||||
|
||||
</StackLayout>
|
||||
</Page>
|
@ -30,7 +30,7 @@ export class Button extends common.Button {
|
||||
return that.get();
|
||||
},
|
||||
|
||||
onClick: function (v) {
|
||||
onClick: function(v) {
|
||||
if (this.owner) {
|
||||
this.owner._emit(common.Button.tapEvent);
|
||||
}
|
||||
@ -44,9 +44,21 @@ export class Button extends common.Button {
|
||||
}
|
||||
}
|
||||
|
||||
private _transformationMethod;
|
||||
public _setFormattedTextPropertyToNative(value) {
|
||||
var newText = value ? value._formattedText : null;
|
||||
if (this.android) {
|
||||
if (newText) {
|
||||
if (!this._transformationMethod) {
|
||||
this._transformationMethod = this.android.getTransformationMethod();
|
||||
}
|
||||
this.android.setTransformationMethod(null);
|
||||
} else {
|
||||
if (this._transformationMethod && !this.android.getTransformationMethod()) {
|
||||
this.android.setTransformationMethod(this._transformationMethod);
|
||||
}
|
||||
}
|
||||
|
||||
this.android.setText(newText);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user