React Native navigation with react-native-router-flux
suggest changeInstall by using npm install --save react-native-router-flux
In react-native-router-flux, each route is a <Scene>:
<Scene key="home" component={LogIn} title="Home" initial />
key is a unique string used to refer to that scene.
component is the component to show. Here it is LogIn.
title sets the navigation-bar title, here Home.
initial marks the first screen of the app.
Example:
import React from 'react';
import { Scene, Router } from 'react-native-router-flux';
import LogIn from './components/LogIn';
import SecondPage from './components/SecondPage';
const RouterComponent = () => {
return (
<Router>
<Scene key="login" component={LogIn} title="Login Form" initial />
<Scene key="secondPage" component={SecondPage} title="Home" />
</Router>
);
};
export default RouterComponent;
Import this file from your root component (for example App.js or the index file) and render it. More detail is in the mini tutorial.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents