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
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
Types of Navigation
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 NavigationTab NavigatorDrawer NavigationWhile 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');
Β