Skip to content

Commit d7396d1

Browse files
committed
Updated documentation with new capabilities
1 parent 253dc8e commit d7396d1

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class App extends React.Component {
6868
* Actions.ACTION_NAME(PARAMS) will call appropriate action and params will be passed to the scene.
6969
* Actions.pop() will pop the current screen.
7070
* Actions.refresh(PARAMS) will update the properties of current screen.
71-
71+
7272
## Available imports
7373
- Router
7474
- Scene
@@ -86,7 +86,7 @@ class App extends React.Component {
8686
| Property | Type | Default | Description |
8787
|---------------|----------|--------------|----------------------------------------------------------------|
8888
| reducer | function | | optional user-defined reducer for scenes, you may want to use it to intercept all actions and put your custom logic |
89-
| createReducer | function | | function that returns a reducer function for {initialState, scenes} param, you may wrap Reducer(param) with your custom reducer, check Flux usage section below|
89+
| createReducer | function | | function that returns a reducer function for {initialState, scenes} param, you may wrap Reducer(param) with your custom reducer, check Flux usage section below|
9090
| other props | | | all properties that will be passed to all your scenes |
9191
| children | | required (if no scenes property passed)| Scene root element |
9292
| scenes | object | optional | scenes for Router created with Actions.create. This will allow to create all actions BEFORE React processing. If you don't need it you may pass Scene root element as children |
@@ -100,7 +100,7 @@ class App extends React.Component {
100100
| tabs| bool | false | Defines 'TabBar' scene container, so child scenes will be displayed as 'tabs'. If no `component` is defined, built-in `TabBar` is used as renderer. All child scenes are wrapped into own navbar.
101101
| initial | bool | false | Set to `true` if this is the initial scene |
102102
| duration | number | 250 | Duration of transition (in ms) |
103-
| direction | string | 'horizontal' | direction of animation horizontal/vertical |
103+
| direction | string | 'horizontal' | direction of animation horizontal/vertical |
104104
| title | string | null | The title to be displayed in the navigation bar |
105105
| navBar | React.Component | | optional custom NavBar for the scene. Check built-in NavBar of the component for reference |
106106
| hideNavBar | bool | false | hides navigation bar for this scene |
@@ -227,7 +227,7 @@ To display a modal use `Modal` as root renderer, so it will render first element
227227
This component doesn't depend from any redux/flux library. It uses new React Native Navigation API and provide own reducer for its navigation state.
228228
You may provide own one if you need. To avoid creation of initial state, you may pass reducer creator. Example to print all actions:
229229
```javascript
230-
// remember to add the 'Reducer' to your imports along with Router, Scene, ... like so
230+
// remember to add the 'Reducer' to your imports along with Router, Scene, ... like so
231231
// import { Reducer } from 'react-native-router-flux'
232232
const reducerCreate = params=>{
233233
const defaultReducer = Reducer(params);
@@ -258,7 +258,7 @@ Following example chooses scene depending from sessionID using Redux:
258258
```
259259
260260
## Drawer (side menu) integration
261-
Example of Drawer custom renderer based on react-native-drawer. Note that you have to include drawer to static contextTypes of your NavBar to enable show/hide/toggle side menu:
261+
Example of Drawer custom renderer based on react-native-drawer. Note that the build-in NavBar component supports toggling of drawer. The Drawer implementation just needs to have a function: toggle();
262262
263263
```javascript
264264
import React from 'react-native';
@@ -268,7 +268,8 @@ import {DefaultRenderer} from 'react-native-router-flux';
268268

269269
export default class extends React.Component {
270270
render(){
271-
const children = this.props.navigationState.children;
271+
const navigationState = this.props.navigationState;
272+
let selected = navigationState.children[navigationState.index];
272273
return (
273274
//Material Design Style Drawer
274275
<Drawer
@@ -282,7 +283,7 @@ export default class extends React.Component {
282283
tweenHandler={(ratio) => ({
283284
main: { opacity:Math.max(0.54,1-ratio) }
284285
})}>
285-
<DefaultRenderer navigationState={children[0]} />
286+
<DefaultRenderer navigationState={selected} key={selected.key} {...selected} />
286287
</Drawer>
287288

288289
);

0 commit comments

Comments
 (0)