-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
/
MyControl.ts
25 lines (20 loc) · 655 Bytes
/
MyControl.ts
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
import { EventData } from '@nativescript/core';
import * as stackLayoutModule from '@nativescript/core/ui/layouts/stack-layout';
import * as label from '@nativescript/core/ui/label';
import * as button from '@nativescript/core/ui/button';
export class MyControl extends stackLayoutModule.StackLayout {
constructor() {
super();
var counter: number = 0;
var lbl = new label.Label();
lbl.id = 'my-test-label';
var btn = new button.Button();
btn.text = 'Tap me!';
btn.on(button.tapEvent, (args: EventData) => {
lbl.text = 'Tap ' + counter++;
});
this.addChild(lbl);
this.addChild(btn);
this.className = 'MyStackLayout';
}
}