-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Expand file tree
/
Copy pathtext-decoration-page.ts
More file actions
26 lines (21 loc) · 956 Bytes
/
text-decoration-page.ts
File metadata and controls
26 lines (21 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { EventData, TextBase } from '@nativescript/core';
const possibleValues = ['none', 'underline', 'line-through', 'underline line-through'];
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 currentIndex = possibleValues.indexOf(lbl.textDecoration);
let newIndex = (currentIndex + 1) % possibleValues.length;
let newValue = <any>possibleValues[newIndex];
lbl.textDecoration = newValue;
btn.textDecoration = newValue;
textField.textDecoration = newValue;
textView.textDecoration = 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';
}
}