Lesson 2 React native navigation 2023 06 24

Опубликовано: 15 Март 2026
на канале: Web Development
94
2

2023-06-24

rnfes

git status
no file should be there to be committed

git checkout main

git pull

Create a new branch for today's work

git checkout -b branchName

1. Create a component and call it inside my App.js

Create a folder src and create a new file Home.js inside src.


Now import this Home.js file inside App.js as follows:
import Home from './src/Home';

Use this Home component as follows:

2. Navigation
5 or 10 component


Install following commands:
https://reactnavigation.org/docs/gett...
https://reactnavigation.org/docs/stac...

yarn add @react-navigation/native
Expo:
npx expo install react-native-screens react-native-safe-area-context
yarn add @react-navigation/stack
Expo:
npx expo install react-native-gesture-handler

npx expo install @react-native-masked-view/masked-view


At the top of App.js, add following line:
import 'react-native-gesture-handler';


RN:
yarn add react-native-screens react-native-safe-area-context

yarn add react-native-gesture-handler

yarn add @react-native-masked-view/masked-view