我已经尝试了很多方法,但是没有找到嵌套嵌套的好方法createDrawerNavigator createBottomTabNavigator createStackNavigator
现在
抽屉(createDrawerNavigator)
MainStack(createStackNavigator)
TabNav(createBottomTabNavigator)
主屏幕
结构屏
分类屏幕
工程画面
详细画面
登录屏幕
注册画面
关于我
收集屏幕
登录屏幕
关于我
收集屏幕
当我在MainStack中打开抽屉时,然后单击AboutMe打开AboutMeScreen,这时在AboutMeScreen中,但是当我打开抽屉时,焦点是MainStack
-为什么重点项目是MainStack?我认为目前应该是AboutMe。
here is my code
以前
抽屉(createDrawerNavigator)
MainStack(createStackNavigator)
TabNav(createBottomTabNavigator)
主屏幕
结构屏
分类屏幕
工程画面
详细画面
LoginStack(createStackNavigator)
登录屏幕
注册画面
AboutMeStack(createStackNavigator)
关于我
CollectStack(createStackNavigator)
收集屏幕
这样,当我在MainStack中打开抽屉时,请单击AboutMe打开AboutMeScreen
-AboutMeStack没有headerLeft可以返回
并且,当我在MainStack中打开抽屉时,然后打开LoginScreen,然后打开RegisterScreen
-我不知道如何直接导航到MainStack。
我不知道哪种方法是正确的。
我的英语不是很好,请先学习本机,谢谢
您的环境
|软件|版
| ---------------- | -------
|反应导航| 2.2.0
|反应本机| 0.55.4
最佳答案
这些步骤将有所帮助
我有我的榜样
步骤1:App.js文件我具有以下代码(createStackNavigator)
import HomeScreen from './src/component/Home/homescreen';
.....
const AuthStack = createStackNavigator({
Home : {
screen: HomeActivity,
navigationOptions: {
header:null
}
},
Profile: LoginScreen,
Signup: SignupScreen,
});
const AppStack = createStackNavigator(
{
HomeScene: HomeScreen,
ChooseWallet: ChooseWalletScreen,
ChooseFiatSrn:ChooseFiatScreen,
});
export default createSwitchNavigator(
{
App:AppStack,
Auth:AuthStack,
},
{
initialRouteName:'Auth',
});
setp 2:homescreen.js我有以下代码(createBottomTabNavigator,createDrawerNavigator)
import Ionicons from 'react-native-vector-icons/Ionicons';
....
const Tab = createBottomTabNavigator({
Wallet: WalletScreen,
Request: RequestScreen,
Send: SendScreen,
Exchange: ExchangeScreen,
},
{
navigationOptions: ({ navigation }) => ({
tabBarIcon: ({ focused, tintColor }) => {
const { routeName } = navigation.state;
let iconName;
if (routeName === 'Wallet') {
iconName = `ios-home`;
} else if (routeName === 'Request') {
iconName = `ios-options`;
}else if (routeName === 'Send') {
iconName = `ios-send`;
}else if (routeName === 'Exchange') {
iconName = `ios-swap`;
}
// You can return any component that you like here! We usually use an
// icon component from react-native-vector-icons
return <Ionicons name={iconName} size={25} color={tintColor} />;
},
}),
tabBarOptions: {
activeTintColor: 'steelblue',
inactiveTintColor: 'gray',
},
});
const DrawerNavigation = createDrawerNavigator({
Home:{
screen: Tab,
//Add can more screen
}
});
export default DrawerNavigation;
如果有人遇到任何问题,那就让我来帮助您
关于react-native - 如何嵌套createDrawerNavigator createStackNavigator createBottomTabNavigator,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/50868015/