feat(core): text-shadow support (#8991)

This commit is contained in:
Tiago Alves
2021-01-29 19:46:58 +00:00
committed by Nathan Walker
parent 0750ce5399
commit cbba5ed19d
10 changed files with 133 additions and 28 deletions

View File

@@ -17,6 +17,7 @@ export function loadExamples() {
examples.set('line-height', 'css/line-height-page');
examples.set('decoration', 'css/text-decoration-page');
examples.set('transform', 'css/text-transform-page');
examples.set('shadow', 'css/text-shadow-page');
examples.set('whitespace', 'css/white-space-page');
examples.set('progress-switch', 'css/progress-switch-page');
examples.set('zindex', 'css/zindex-page');

View File

@@ -0,0 +1,26 @@
import { EventData, TextBase } from '@nativescript/core';
const possibleValues = ['2 10 4 rgb(255, 100, 100)', '2 10 2 rgba(10, 10, 10, 0.5)', '1 1 1 #55a', '2 2 2 #aaa', ''];
let currentIndex = 0;
export function butonTap(args: EventData) {
let page = (<TextBase>args.object).page;
let lbl = <TextBase>page.getViewById('Label');
let btn = <TextBase>page.getViewById('Button');
let textField = <TextBase>page.getViewById('TextField');
let textView = <TextBase>page.getViewById('TextView');
let newIndex = currentIndex++ % possibleValues.length;
let newValue = <any>possibleValues[newIndex];
lbl.textShadow = newValue;
btn.textShadow = newValue;
textField.textShadow = newValue;
textView.textShadow = newValue;
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';
}
}

View File

@@ -0,0 +1,9 @@
<Page>
<StackLayout>
<Button id="Change" automationText="Change" text="Change" tap="butonTap" />
<Label id="Label" automationText="Label" text="Label" />
<Button id="Button" automationText="Button" text="Button" />
<TextField id="TextField" automationText="TextField" text="TextField" />
<TextView id="TextView" automationText="TextView" text="TextView" />
</StackLayout>
</Page>