Saturday, October 24, 2020

React-Native How to setup Navigation

 React Navigation is made up of some core utilities and those are then used by navigators to create the navigation structure in your app


The libraries we will install now are react-native-gesture-handler, react-native-reanimated, react-native-screens and react-native-safe-area-context and @react-native-community/masked-view. 


yarn add @react-navigation/native


yarn add react-native-reanimated react-native-gesture-handler react-native-screens react-native-safe-area-context @react-native-community/masked-view


If you're on a Mac and developing for iOS, you need to install the pods (via Cocoapods) to complete the linking.



npx pod-install ios



To finalize installation of react-native-gesture-handler, add the following at the top (make sure it's at the top and there's nothing else before it) of your entry file, such as index.js or App.js:


import 'react-native-gesture-handler';

import * as React from 'react';

import { NavigationContainer } from '@react-navigation/native';


export default function App() {

  return (

    <NavigationContainer>{/* Rest of your app code */}</NavigationContainer>

  );

}



#


references:

https://reactnavigation.org/docs/getting-started

No comments:

Post a Comment