mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Refactored gestures to support more scenarios in android.
This commit is contained in:
@@ -1,5 +1,22 @@
|
||||
import frame = require("ui/frame");
|
||||
import pageModule = require("ui/page");
|
||||
import textViewModule = require("ui/text-view");
|
||||
|
||||
export function buttonTap(args) {
|
||||
frame.topmost().goBack();
|
||||
console.log("tap");
|
||||
}
|
||||
|
||||
export function doubleTap(args) {
|
||||
console.log("doubleTap");
|
||||
}
|
||||
|
||||
export function checkRecognizers(args) {
|
||||
var testTextView = <textViewModule.TextView>(page.getViewById("testTextView"));
|
||||
console.log("testTextView: " + testTextView.ios.gestureRecognizers);
|
||||
}
|
||||
|
||||
var page: pageModule.Page;
|
||||
|
||||
export function pageLoaded(args) {
|
||||
page = <pageModule.Page>args.object;
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
<Page xmlns="http://www.nativescript.org/tns.xsd">
|
||||
<Button text="Back" tap="buttonTap"/>
|
||||
<Page xmlns="http://www.nativescript.org/tns.xsd" loaded="pageLoaded">
|
||||
<StackLayout>
|
||||
<TextView text="TEST FOR GESTURES" id="testTextView" style="font-size: 50" tap="buttonTap" doubleTap="doubleTap"/>
|
||||
<Button text="CLICK" tap="checkRecognizers" />
|
||||
</StackLayout>
|
||||
</Page>
|
||||
|
||||
@@ -18,6 +18,7 @@ import listViewModule = require("ui/list-view");
|
||||
import helper = require("../ui/helper");
|
||||
import viewModule = require("ui/core/view");
|
||||
import platform = require("platform");
|
||||
import gesturesModule = require("ui/gestures");
|
||||
|
||||
export function test_load_IsDefined() {
|
||||
TKUnit.assert(types.isFunction(builder.load), "ui/builder should have load method!");
|
||||
@@ -186,7 +187,7 @@ export function test_parse_ShouldParseBindingsToGestures() {
|
||||
p.bindingContext = context;
|
||||
var lbl = <labelModule.Label>p.content;
|
||||
|
||||
var observer = (<any>lbl)._gesturesObserver;
|
||||
var observer = (<any>lbl)._gestureObservers[gesturesModule.GestureTypes.tap][0];
|
||||
|
||||
TKUnit.assert(observer !== undefined, "Expected result: true.");
|
||||
TKUnit.assert(observer._context === context, "Context should be equal to binding context. Actual result: " + observer._context);
|
||||
|
||||
Reference in New Issue
Block a user