React Navigation
React Navigation is used for managing the transition between multiple screens. It is written in JavaScript and does not directly use the native navigation APIs on iOS and Android.
- Install the required packages in your React Native project:
npm install @react-navigation/native
- Also installing dependencies into a bare react native project.In your project directory run:
npm install react-native-screens react-native-safe-area-context
- Now, we need to wrap the whole app in NavigationContainer. Usually you'd do this in your entry file, such as App.js:
import * as React from 'react';
import { NavigationContainer } from '@react-navigation/native';
export default function App() {
return (
<NavigationContainer>{/* Rest of your app code */}</NavigationContainer>
);
}