Complete the code to import the bottom tab navigator from React Navigation.
import { create[1]BottomTabNavigator } from '@react-navigation/bottom-tabs';
The function to create a bottom tab navigator is createBottomTabNavigator. You import it directly from '@react-navigation/bottom-tabs'.
Complete the code to create a bottom tab navigator instance.
const Tab = [1]BottomTabNavigator();You create a bottom tab navigator by calling the function createBottomTabNavigator() and assigning it to a variable.
Fix the error in the code to define a screen inside the bottom tab navigator.
<Tab.Navigator> <Tab.Screen name="Home" component=[1] /> </Tab.Navigator>
The component prop expects a React component, such as HomeScreen, not a string or other value.
Fill both blanks to set the initial route and screen options in the bottom tab navigator.
<Tab.Navigator initialRouteName=[1] screenOptions=[2]> <Tab.Screen name="Profile" component={ProfileScreen} /> </Tab.Navigator>
The initialRouteName should be the name of the screen as a string, here "Profile". The screenOptions is an object to customize the tab bar, such as setting the active tint color.
Fill all three blanks to add two screens and export the tab navigator as the main app component.
function App() {
return (
<NavigationContainer>
<Tab.Navigator>
<Tab.Screen name=[1] component={HomeScreen} />
<Tab.Screen name=[2] component={SettingsScreen} />
</Tab.Navigator>
</NavigationContainer>
);
}
export default [3];The screen names must be strings matching the screen purpose, here "Home" and "Settings". The exported component is the App function.