mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
feat(core): text-shadow support (#8991)
This commit is contained in:
committed by
Nathan Walker
parent
0750ce5399
commit
cbba5ed19d
@@ -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');
|
||||
|
||||
26
apps/ui/src/css/text-shadow-page.ts
Normal file
26
apps/ui/src/css/text-shadow-page.ts
Normal 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';
|
||||
}
|
||||
}
|
||||
9
apps/ui/src/css/text-shadow-page.xml
Normal file
9
apps/ui/src/css/text-shadow-page.xml
Normal 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>
|
||||
Reference in New Issue
Block a user