简体   繁体   English

在 nativescript 核心上使用平移手势自定义过渡

[英]Custom transition using pan gesture on nativescript core

Is it possible to achieve the page transition shown in the image below using nativescript core?是否可以使用 nativescript core 实现下图所示的页面转换?

As you can see, to make the transition from one view to the previous (parent) one, I'm making a pan gesture slowly and depending on where my finger horizontally is, the view is being shown and coming into existence from left.如您所见,为了从一个视图过渡到前一个(父)视图,我正在缓慢地做出平移手势,并根据我的手指水平位置,视图从左侧显示并出现。 You can't see the finger but you can see the slow transition controlled by my finger.你看不到手指,但你可以看到我的手指控制的缓慢过渡。 I'm making a pan gesture from very left of screen to the right.我正在从屏幕的最左侧到右侧进行平移手势。 The transitions that I've so far read about, run in one go without giving any control to the user.到目前为止,我所读到的转换都是一次性运行的,不会给用户任何控制权。 Is this one possible using nativescript core?这可以使用 nativescript 核心吗?

ios过渡示例

So far I've tried writing a custom transition class/method and providing it as a transition instance to navigation entry, but couldn't find a way to manually control the actual transition using pan gesture.到目前为止,我已经尝试编写自定义过渡类/方法并将其作为导航条目的过渡实例提供,但找不到使用平移手势手动控制实际过渡的方法。

const customNavigation = new CustomTransitionIOS(4000, 2);
const navigationEntry: NavigationEntry = {
    moduleName: "settings",
    animated: true,
    transition: {
        instance: customNavigation
    },
    context: {
        name: "John"
    },
    clearHistory: true
};

Found it.找到了。 I actually needed to use Frame.topmost() function instead of simply navigating to another view.我实际上需要使用 Frame.topmost() 函数而不是简单地导航到另一个视图。

Frame.topmost().navigate('another-page');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM