mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-18 13:51:27 +08:00

in some weird cases like i some UICollectionView layouts the UIControlEvents.TouchUpInside is failing
23 lines
483 B
TypeScript
23 lines
483 B
TypeScript
import { StackLayout, Label, Button, EventData } from '@nativescript/core';
|
|
import { tapEvent } from '@nativescript/core/ui/button';
|
|
|
|
export class MyControl extends StackLayout {
|
|
constructor() {
|
|
super();
|
|
|
|
var counter: number = 0;
|
|
|
|
var lbl = new Label();
|
|
var btn = new Button();
|
|
btn.text = 'Tap me!';
|
|
btn.on(tapEvent, (args: EventData) => {
|
|
lbl.text = 'Tap ' + counter++;
|
|
});
|
|
|
|
this.addChild(lbl);
|
|
this.addChild(btn);
|
|
|
|
this.className = 'MyStackLayout';
|
|
}
|
|
}
|