Basics of React Native Navigation

The first big change is the lack of the AppRegistry and the registerComponent call. Instead, we will use Navigation.setRoot(...) and it will do the job. The setRoot function should only be invoked if we are certain that the application was launched successfully, as shown here:

// src / Chapter 7 / Example 7 / src / screens / index.jsimport { Navigation } from 'react-native-navigation';// ...export default () => Navigation.events().registerAppLaunchedListener(() => {    Navigation.setRoot({        // ...    });});

Our root/entry file will then only invoke the React Native Navigation function:

import start from './src/screens/index';export default start();

Okay. The more interesting part is what we put into the setRoot ...

Get Hands-On Design Patterns with React Native now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.