抽屉导航不显示在反应导航中
Drawer navigation not displaying in react-navigation
我正在使用 react-navigation 3 版本和 react native 0.59 版本。
我正在为登录代码使用切换导航。一旦我登录,它就会重定向到主屏幕,主屏幕上的其他导航工作正常,但抽屉图标不显示。
我的navigator.js
export const AppStack = createStackNavigator({
Home: {
screen: HomeScreen,
navigationOptions: {
headerRight:soundicon()
}
},
withdraw: {
screen: WithdrawScreen,
navigationOptions: {
headerRight:soundicon()
}
},
deposite: {
screen: DepositScreen,
navigationOptions: {
headerRight:soundicon()
}
},
money: {
screen: MoneyScreen,
navigationOptions: {
headerRight:soundicon()
}
}
});
export const drawermenu = createDrawerNavigator({
Home: AppStack,
})
export const AuthStack = createStackNavigator({
SignIn: {
screen: SignInScreen,
navigationOptions: {
header: null,
}
},
Signup: {
screen: SignupScreen,
navigationOptions: {
}
},
ForgotPassword: {
screen: ForgotPasswordScreen,
navigationOptions: {
}
}
});
export const AppNavigator = createSwitchNavigator(
{
AuthLoading: AuthLoadingScreen,
App: drawermenu,
Auth: AuthStack,
},
{
initialRouteName: 'AuthLoading',
});
export const AppNavigatorObj = createAppContainer(AppNavigator)
因为它是你可以通过向右滑动打开抽屉,如果你想用图标打开它你必须制作一个header组件并在你想要的屏幕上使用它。这是 headers 的一个很好的例子:https://react-native-training.github.io/react-native-elements/docs/header.html
我正在使用 react-navigation 3 版本和 react native 0.59 版本。 我正在为登录代码使用切换导航。一旦我登录,它就会重定向到主屏幕,主屏幕上的其他导航工作正常,但抽屉图标不显示。
我的navigator.js
export const AppStack = createStackNavigator({
Home: {
screen: HomeScreen,
navigationOptions: {
headerRight:soundicon()
}
},
withdraw: {
screen: WithdrawScreen,
navigationOptions: {
headerRight:soundicon()
}
},
deposite: {
screen: DepositScreen,
navigationOptions: {
headerRight:soundicon()
}
},
money: {
screen: MoneyScreen,
navigationOptions: {
headerRight:soundicon()
}
}
});
export const drawermenu = createDrawerNavigator({
Home: AppStack,
})
export const AuthStack = createStackNavigator({
SignIn: {
screen: SignInScreen,
navigationOptions: {
header: null,
}
},
Signup: {
screen: SignupScreen,
navigationOptions: {
}
},
ForgotPassword: {
screen: ForgotPasswordScreen,
navigationOptions: {
}
}
});
export const AppNavigator = createSwitchNavigator(
{
AuthLoading: AuthLoadingScreen,
App: drawermenu,
Auth: AuthStack,
},
{
initialRouteName: 'AuthLoading',
});
export const AppNavigatorObj = createAppContainer(AppNavigator)
因为它是你可以通过向右滑动打开抽屉,如果你想用图标打开它你必须制作一个header组件并在你想要的屏幕上使用它。这是 headers 的一个很好的例子:https://react-native-training.github.io/react-native-elements/docs/header.html