mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-10 09:13:43 +08:00
- @react-navigation/bottom-tabs@5.0.0-alpha.13 - @react-navigation/compat@5.0.0-alpha.7 - @react-navigation/core@5.0.0-alpha.14 - @react-navigation/drawer@5.0.0-alpha.13 - @react-navigation/example@5.0.0-alpha.12 - @react-navigation/material-bottom-tabs@5.0.0-alpha.12 - @react-navigation/material-top-tabs@5.0.0-alpha.11 - @react-navigation/native@5.0.0-alpha.11 - @react-navigation/stack@5.0.0-alpha.24
@react-navigation/bottom-tabs
Bottom tab navigator for React Navigation following iOS design guidelines.
Installation
Open a Terminal in your project's folder and run,
yarn add @react-navigation/core @react-navigation/bottom-tabs
Now we need to install react-native-safe-area-context.
If you are using Expo, to ensure that you get the compatible versions of the libraries, run:
expo install react-native-safe-area-context
If you are not using Expo, run the following:
yarn add react-native-safe-area-context
If you are using Expo, you are done. Otherwise, continue to the next steps.
To complete the linking on iOS, make sure you have Cocoapods installed. Then run:
cd ios
pod install
cd ..
Usage
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
const BottomTabs = createBottomTabNavigator();
export default function App() {
return (
<BottomTabs.Navigator>
<BottomTabs.Screen
name="article"
component={Article}
options={{
tabBarLabel: 'Article',
tabBarIcon: 'chrome-reader-mode',
}}
/>
<BottomTabs.Screen
name="chat"
component={Chat}
options={{
tabBarLabel: 'Chat',
tabBarIcon: 'chat-bubble',
}}
/>
<BottomTabs.Screen
name="contacts"
component={Contacts}
options={{
tabBarLabel: 'Contacts',
tabBarIcon: 'contacts',
}}
/>
</BottomTabs.Navigator>
);
}