Responding to routes
Let's implement a simple UI with three scenes in it (remember, scenes are synonymous with pages). Each scene will link to the other two scenes so that you can actually navigate the application. Let's start with the main application module:
import React from 'react'; import { AppRegistry, Navigator, } from 'react-native'; import routes from './routes'; // Renders a scene. The "Scene" is a React component, and // is found as a property of the "route". The "navigator" // instance is passed to the scene as a property. const renderScene = (route, navigator) => ( <route.Scene navigator={navigator} /> ); // Renders a "<Navigator>" component. This is the root // component of the application because it manages // "scenes" that represent ...
Get React and 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.