mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
gesture binding fixed + test
This commit is contained in:
16
apps/ui-tests-app/pages/gesture-binding.ts
Normal file
16
apps/ui-tests-app/pages/gesture-binding.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import observable = require("data/observable");
|
||||
import gestures = require("ui/gestures");
|
||||
import pages = require("ui/page");
|
||||
|
||||
export function pageLoaded(args: observable.EventData) {
|
||||
var page = <pages.Page>args.object;
|
||||
page.bindingContext = { tapAction: tapAction, doubleTapAction: doubleTapAction };
|
||||
}
|
||||
|
||||
export function tapAction(args: gestures.GestureEventData) {
|
||||
console.log("tapAction")
|
||||
}
|
||||
|
||||
export function doubleTapAction(args: gestures.GestureEventData) {
|
||||
console.log("doubleTapAction")
|
||||
}
|
||||
6
apps/ui-tests-app/pages/gesture-binding.xml
Normal file
6
apps/ui-tests-app/pages/gesture-binding.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<Page loaded="pageLoaded">
|
||||
<StackLayout>
|
||||
<Label text="Handlers as exports" tap="tapAction" doubleTap="doubleTapAction" />
|
||||
<Label text="Bound handlers" tap="{{ tapAction }}" doubleTap="{{ doubleTapAction }}" />
|
||||
</StackLayout>
|
||||
</Page>
|
||||
Reference in New Issue
Block a user