O'Reilly logo

Hands-On Design Patterns with React Native by Mateusz Grzesiukiewicz

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required