Custom transition using pan gesture on nativescript core

[亡魂溺海] 提交于 2021-01-29 21:34:44

问题


Is it possible to achieve the page transition shown in the image below using 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?

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
};

回答1:


Found it. I actually needed to use Frame.topmost() function instead of simply navigating to another view.

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


来源:https://stackoverflow.com/questions/60350070/custom-transition-using-pan-gesture-on-nativescript-core

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!