A Tab Navigator is a way to switch between different screens using tabs usually placed at the bottom of the app. It helps users move easily between main sections.
Click to reveal answer
beginner
Which library is commonly used to create bottom tab navigation in React Native?
React Navigation library, specifically the @react-navigation/bottom-tabs package, is commonly used to create bottom tab navigators.
Click to reveal answer
intermediate
How do you define a simple bottom tab navigator with two tabs named Home and Settings?
You import createBottomTabNavigator from @react-navigation/bottom-tabs, create a Tab navigator, then add <Tab.Screen> components for Home and Settings screens inside <Tab.Navigator>.
Click to reveal answer
intermediate
What is the purpose of the 'screenOptions' prop in a Tab Navigator?
The 'screenOptions' prop lets you customize the look and behavior of all tabs, like icons, colors, and labels, so the tabs look consistent and user-friendly.
Click to reveal answer
intermediate
How can you make a tab icon change color when selected in a bottom tab navigator?
You use the 'tabBarIcon' option inside 'screenOptions' or individual screen options. It receives a focused boolean to change icon color depending on selection.
Click to reveal answer
Which component creates a bottom tab navigator in React Native?
AcreateStackNavigator
BcreateSwitchNavigator
CcreateDrawerNavigator
DcreateBottomTabNavigator
✗ Incorrect
The createBottomTabNavigator function from @react-navigation/bottom-tabs creates a bottom tab navigator.
Where are bottom tabs usually placed in a mobile app?
AAt the top of the screen
BAt the bottom of the screen
CIn the middle of the screen
DIn a side drawer
✗ Incorrect
Bottom tabs are placed at the bottom of the screen for easy thumb access and clear navigation.
Which prop lets you customize tab icons and labels in a bottom tab navigator?
AscreenOptions
BtabBarOptions
CtabBarStyle
DheaderOptions
✗ Incorrect
The screenOptions prop allows customization of icons, labels, and styles for tabs.
How do you show a different icon when a tab is selected?
AChange the tabBarLabel
BChange the screen name
CUse tabBarIcon with a focused parameter
DUse a different navigator
✗ Incorrect
The tabBarIcon function receives a focused boolean to change the icon based on selection.
Which package must be installed to use bottom tab navigation in React Native?
A@react-navigation/bottom-tabs
Breact-native-tab-view
C@react-navigation/stack
Dreact-native-navigation
✗ Incorrect
The @react-navigation/bottom-tabs package provides bottom tab navigation.
Explain how to set up a basic bottom tab navigator with two screens in React Native.
Think about the main steps to create tabs and show screens.
You got /4 concepts.
Describe how you can customize the appearance of tabs, including changing icons when selected.
Focus on the options that control tab look and behavior.
You got /4 concepts.
Practice
(1/5)
1. What is the main purpose of a Bottom Tab Navigator in a React Native app?
easy
A. To handle user authentication and login
B. To display a list of items in a vertical scroll
C. To allow users to switch between main screens using tabs at the bottom
D. To create pop-up alerts and notifications
Solution
Step 1: Understand the role of Bottom Tab Navigator
The Bottom Tab Navigator provides a set of tabs at the bottom of the screen for easy navigation between main app screens.
Step 2: Compare with other options
Options A, B, and D describe different app features unrelated to tab navigation.
Final Answer:
To allow users to switch between main screens using tabs at the bottom -> Option C
Quick Check:
Bottom Tab Navigator = Easy screen switching [OK]
Hint: Tabs at bottom mean screen switching, not lists or alerts [OK]
Common Mistakes:
Confusing tab navigator with list views
Thinking it handles login or alerts
Mixing up navigation types
2. Which of the following is the correct way to wrap a Bottom Tab Navigator in React Native?
easy
A.
B.
C.
D.
Solution
Step 1: Identify correct wrapping order
The Bottom Tab Navigator must be inside the NavigationContainer to manage navigation state properly.
Step 2: Check each option
<NavigationContainer><Tab.Navigator></Tab.Navigator></NavigationContainer> correctly wraps Tab.Navigator inside NavigationContainer. <Tab.Navigator><NavigationContainer></NavigationContainer></Tab.Navigator> reverses the order, which is incorrect. <NavigationContainer><Stack.Navigator></Stack.Navigator></NavigationContainer> uses Stack.Navigator, not Tab.Navigator. <Tab.Screen><NavigationContainer></NavigationContainer></Tab.Screen> incorrectly wraps NavigationContainer inside Tab.Screen.
Final Answer:
<NavigationContainer><Tab.Navigator></Tab.Navigator></NavigationContainer> -> Option B
Quick Check:
NavigationContainer wraps Tab.Navigator [OK]
Hint: NavigationContainer always wraps the navigator component [OK]
Common Mistakes:
Placing NavigationContainer inside Tab.Navigator
Using Stack.Navigator instead of Tab.Navigator
Wrapping NavigationContainer inside Tab.Screen
3. Given this code snippet, what label will appear on the second tab?
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
const Tab = createBottomTabNavigator();
function MyTabs() {
return (
);
}
medium
A. Config
B. Settings
C. SettingsScreen
D. Home
Solution
Step 1: Check the tabBarLabel option for the second tab
The second Tab.Screen has options={{ tabBarLabel: 'Config' }}, which overrides the default label.
Step 2: Understand default vs custom labels
Without tabBarLabel, the label would be the name prop 'Settings'. But here, it is replaced by 'Config'.
Final Answer:
Config -> Option A
Quick Check:
tabBarLabel overrides name label [OK]
Hint: Look for tabBarLabel option to find displayed tab label [OK]
Common Mistakes:
Using the name prop as label ignoring tabBarLabel
Confusing component name with label
Assuming default label always shows
4. Identify the error in this Bottom Tab Navigator code:
5. You want to add icons to your Bottom Tab Navigator tabs using the tabBarIcon option. Which approach correctly adds a simple icon component to the tabs?
hard
A. Use }} /> inside Tab.Navigator
B. Add directly inside Tab.Navigator without options
C. Wrap Tab.Navigator inside <Icon> component
D. Set tabBarIcon as a string like 'home' in Tab.Screen options
Solution
Step 1: Understand tabBarIcon usage
The tabBarIcon option expects a function returning a React element, typically an icon component.
Step 2: Evaluate each option
Use <Tab.Screen options={{ tabBarIcon: () => <Icon name='home' /> }} /> inside Tab.Navigator correctly uses a function returning <Icon name='home' /> inside options. Add <Icon name='home' /> directly inside Tab.Navigator without options incorrectly places Icon directly inside Tab.Navigator. Wrap Tab.Navigator inside <Icon> component wraps Tab.Navigator inside Icon, which is invalid. Set tabBarIcon as a string like 'home' in Tab.Screen options sets tabBarIcon as a string, which is not supported.
Final Answer:
Use <Tab.Screen options={{ tabBarIcon: () => <Icon name='home' /> }} /> inside Tab.Navigator -> Option A
Quick Check:
tabBarIcon needs a function returning icon component [OK]
Hint: tabBarIcon must be a function returning an icon component [OK]
Common Mistakes:
Placing icon components outside options
Using strings instead of functions for tabBarIcon
Wrapping navigator inside icon components
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.