尝试配置包含标签导航的导航。
这是我在MainApp中所做的:
const AppTabNavigator = createBottomTabNavigator({
Home: {
screen: Home
},
Settings:{
screen: Settings
}
});
const AuthStackNavigator = createStackNavigator({
Welcome: Welcome,
SignIn: SignIn,
SignUp: SignUp });
const AppStackNavigator = createStackNavigator({
AppTabNavigator: {
screen: AppTabNavigator,
navigationOptions: ({navigation}) => ({
title: '',
headerLeft: (
<TouchableOpacity onPress={()=>navigation.toggleDrawer()}>
<View style={{ paddingHorizontal: 10 }}>
<Ionicons name="md-menu" size={24} />
</View>
</TouchableOpacity>
)
})
}
});
const AppDrawerNavigator = createDrawerNavigator({
Home: AppStackNavigator
});
const App = createAppContainer(createSwitchNavigator(
{
AuthLoading: AuthInterceptorService,
Auth: AuthStackNavigator,
App: AppDrawerNavigator,
},
{
initialRouteName: 'AuthLoading',
}
));
挑战:
如何将导航和navigationoptions
添加到抽屉中的Home项目中,并且标签navigator
已经注入Home项目中?