如何在Nativescript中使用滑动手势在页面之间实现导航
问题描述:
我想实现页面之间的导航,就像通过向左或向右滑动TabView所做的一样。但是,轻扫手势似乎不是针对页面级别触发的,也不是针对跨整个屏幕的布局触发的。 TabView本身并不实用,因为我有大量的用户可以滚动的项目集合,而且我不需要在屏幕上显示一堆选项卡。如何在Nativescript中使用滑动手势在页面之间实现导航
有谁知道如何在Nativescript中实现这个?
答
你好StackOverflow和NatieScript!整个屏幕上的布局元素是一个工作选项。
例如:
// main-page.xml
<Page xmlns="http://schemas.nativescript.org/tns.xsd" xmlns:drawer="nativescript-telerik-ui/sidedrawer" navigatingTo="navigatingTo" loaded="onLoaded">
<StackLayout id="swipable">
<Label text="Swipe to nabigate to next" textWrap="true" />
</StackLayout>
</Page>
// main-page.js
var stackModule = require("ui/layouts/stack-layout");
var gestures = require("ui/gestures");
var frameModule = require("ui/frame");
function onLoaded(args) {
var page = args.object;
var myStack = page.getViewById("swipable");
myStack.on(gestures.GestureTypes.swipe, function (args) {
frameModule.topmost().navigate({
moduleName: "next-page"
});
});
}
exports.onLoaded = onLoaded;
任何人找这应该在这里投票:https://nativescript.ideas.aha.io/ideas/NS-I-32 –