因此,我有一个自定义导航器,可用于向后滑动导航。 另外,对于某些真正的原因,我也很抱歉张贴图片并且不粘贴代码。希望您能查看图片。
下面是自定义导航器的代码。 https://gist.github.com/shubham6996/985568f49b2511dec2438c624fe259d0
const SwipeMainStack = () => {
return(
<Navigator>
<Route name="LoggedOutHome" component={LoggedOutHome} />
<Route name="SignUp" component={SignUp} />
<Route name="EmailAuth" component={EmailAuth} />
<Route name="Login" component={Login} />
<Route name="EmailLogin" component={EmailLogin} />
<Route name="EmailSignUp" component={EmailSignUp} />
<Route name="SignupUsername" component={SignupUsername} />
</Navigator>
);
}
const stack = createStackNavigator({
SwipeStack: {screen: SwipeMainStack},
TabHolder: {screen: TabHolder},
}, {
initialRouteName: 'SwipeStack',
headerMode: 'none',
});
export default createAppContainer(stack);
导航是这样的,当我导航到SignUp
屏幕时,它将带我到EmailSignUp
,然后将我带到EmailAuth
。
我可以使用LoggedOutHome
从EmailAuth
导航到this.props.navigator.push('SignUp')
屏幕,但不能从EmailAuth
导航到SignUp
>
答案 0 :(得分:0)
如果您像下面那样定义SwipeMainStack,那么它应该可以工作。
const SwipeMainStack = createStackNavigator({
LoggedOutHome: LoggedOutHome,
SignUp: SignUp,
EmailAuth:EmailAuth
Login:Login
EmailLogin:EmailLogin
EmailSignUp:EmailSignUp
SignupUsername:SignupUsername
})
const stack = createStackNavigator({
SwipeStack: SwipeMainStack
TabHolder: TabHolder,
}, {
initialRouteName: 'SwipeStack',
headerMode: 'none',
});
export default createAppContainer(stack);