aksonov /react-native-router-flux

The first declarative React Native router

★ 8,907⑂ 2,057👁 188⑃ 737● 3,107▤ 53
JavaScriptMITCreated 2015-08-25
Download: 4.3.14.3.1 ↓4.3.12021-03-26
-1
Daily
8,907
stars
2,057
forks
188
watchers
737
prs
3,107
issues
53
releases

README

React Native Router (v4.x)      

Follow author @PAksonov

react-native-router-flux is a different API over react-navigation. It helps users to define all the routes in one central place and navigate and communicate between different screens in an easy way. But it also means that react-native-router-flux inherits all limitations and changes from updated versions.

 IMPORTANT NOTES
 v5.0.alpha.x is based on React Navigation v5.x (very early alpha, development in progress, help wanted!)

 v4.2.x is based on React Navigation v4.x

 v4.1.0-beta.x is based on React Navigation v3.x

 v4.0.x is based on [React Navigation v2.x]. See this branch and docs for v3 based on deprecated React Native Experimental Navigation API. It is not supported and may not work with latest React Native versions.

 v4.0.0-beta.x is based on React Navigation v1.5.x. See this branch for this version. It is also not supported and may not work with the latest React Native versions.

---

- Examples
- Motivation
- v4 Features
- API
- Migrating from v3
- Sponsors/Backers/Contributors

 Getting Started

1. Install native dependencies used by RNRF (see below, https://reactnavigation.org/docs/en/getting-started.html)
2. Install this component

sh
yarn add react-native-router-flux


 install the following libraries first
1. react-native-screens by (  npm install react-native-screens || yarn add react-native-screens )
2. react-native-gesture-handler (  npm install react-native-gesture-handler || yarn add react-native-gesture-handler )
3. react-native-reanimated ( npm install react-native-reanimated || yarn add react-native-reanimated )
4. react-native-safe-area-context ( npm install react-native-safe-area-context || yarn add react-native-react-native-safe-area-context )
5. @react-native-community/masked-view ( npm install @react-native-community/masked-view || yarn add @react-native-community/masked-view )



 Usage

Define all your routes in one React component...

jsx
const App = () = (
  
    
      
      
      
    
  
);


...and navigate from one scene to another scene with a simple and powerful API.

jsx
// Login.js

// navigate to 'home' as defined in your top-level router
Actions.home(PARAMS);

// go back (i.e. pop the current screen off the nav stack)
Actions.pop();

// refresh the current Scene with the specified props
Actions.refresh({ param1: 'hello', param2: 'world' });


 API

For a full listing of the API, view the API docs.

 Try the example apps

!rnrf

sh
 Get the code
git clone https://github.com/aksonov/react-native-router-flux.git
cd react-native-router-flux/examples/[expo|react-native|redux]

 Installing dependencies
yarn

 Run it
yarn start


 v4 Features

- Based on latest React Navigation API
- Separate navigation logic from presentation. You may now change navigation state directly from your business logic code - stores/reducers/etc. navigationStore
- Built-in state machine (v3 Switch replacement)
  - Each Scene with component defined can have onEnter/onExit

Top issues

Latest release

4.3.1 4.3.1 2021-03-26
Bug fixed:
 - 3741

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON