React navigation
🧡

React navigation

first we have to install the react navigation library
npm install @react-navigation/native
then we have to install two other library with this to make use of some navigation functions
npm install react-native-screens // then npm install react-native-safe-area-context
after install these many library we have to sync these with our android project
notion image
So just run the gradle build command to sync the newly installed libraries
After building the gradle it will download the library with the native code
notion image
Types of Navigation
notion image
download the stack navigation
npm install @react-navigation/native-stack
You need not to build the gradle again because it is not a native library ( it is just a functionality of the library which was downloaded)

How to use in the project

πŸ”₯
To use the navigation in our project we have to make an entry point as a navigation container ( Navigation container must be one in a project)

Types Of Navigation

β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’β‡’
🧷
Stack Navigation
πŸ“΅
Tab Navigator
🌌
Drawer Navigation

While Navigating to screen Pass Data

navigation.navigate('Screen2', {text: 'Hello from Screen 1' });
Β 
Β 
To get the data on that screen
And we can capture it inΒ Screen2 by doing the following, the first value inΒ getParamsΒ is theΒ keyΒ the second value is the default value.
const text = navigation.getParams('text','nothing sent');
Β