mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-14 18:12:09 +08:00
feat(css): text-stroke support (#10399)
closes https://github.com/NativeScript/NativeScript/issues/3597 closes https://github.com/NativeScript/NativeScript/issues/3972
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Page, Observable, EventData } from '@nativescript/core';
|
||||
import { Page, Observable, EventData, Label, Color } from '@nativescript/core';
|
||||
|
||||
let page: Page;
|
||||
|
||||
@ -7,4 +7,23 @@ export function navigatingTo(args: EventData) {
|
||||
page.bindingContext = new SampleData();
|
||||
}
|
||||
|
||||
export class SampleData extends Observable {}
|
||||
export class SampleData extends Observable {
|
||||
strokeLabel: Label;
|
||||
|
||||
loadedStrokeLabel(args) {
|
||||
this.strokeLabel = args.object;
|
||||
}
|
||||
|
||||
toggleStrokeStyle() {
|
||||
if (this.strokeLabel.style.textStroke) {
|
||||
this.strokeLabel.style.color = new Color('black');
|
||||
this.strokeLabel.style.textStroke = null;
|
||||
} else {
|
||||
this.strokeLabel.style.color = new Color('white');
|
||||
this.strokeLabel.style.textStroke = {
|
||||
color: new Color('black'),
|
||||
width: { value: 2, unit: 'px' },
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,9 @@
|
||||
<GridLayout marginTop="10" borderWidth="1" borderColor="#efefef" height="60" paddingLeft="5">
|
||||
<Button text="Test Button text-overflow: initial, this should be long sentence and truncated in the middle with ellipsis." textOverflow="initial" whiteSpace="nowrap" />
|
||||
</GridLayout>
|
||||
<GridLayout marginTop="10" height="60" paddingLeft="5" tap="{{toggleStrokeStyle}}">
|
||||
<Label text=" text-stroke" style="text-stroke: 2px black; color: #fff; font-size: 35; font-weight: bold; font-family:Arial, Helvetica, sans-serif" loaded="{{loadedStrokeLabel}}"/>
|
||||
</GridLayout>
|
||||
<Label text="maxLines 2" fontWeight="bold" marginTop="10" />
|
||||
<Label
|
||||
text="Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum."
|
||||
|
Reference in New Issue
Block a user