这是我的带有三个导航屏幕的应用程序。
import React from 'react';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import Scan from '../containers/scan';
import List from '../containers/list';
import More from './more';
const Tab = createBottomTabNavigator();
function Home(props) {
return (
<Tab.Navigator>
<Tab.Screen
name="List"
component={List}
/>
<Tab.Screen
name="Scan"
component={Scan}
/>
<Tab.Screen
name="More"
component={More}
/>
</Tab.Navigator>
);
}
export default Home;
启动应用程序时,“列表”屏幕可见。
如何将“扫描”屏幕设置为默认屏幕?
答案 0 :(得分:2)
您必须像下面那样设置导航器的initialRouteName属性
<Tab.Navigator initialRouteName="Scan">
<Tab.Screen
name="List"
component={List}
/>
<Tab.Screen
name="Scan"
component={Scan}
/>
<Tab.Screen
name="More"
component={More}
/>
</Tab.Navigator>