|
| 1 | +# API and Configuration |
| 2 | + |
| 3 | +## Available imports |
| 4 | +- `Router` |
| 5 | +- `Scene` |
| 6 | +- `Modal` |
| 7 | +- `TabBar` |
| 8 | +- `getInitialState` |
| 9 | +- `Reducer` |
| 10 | +- `DefaultRenderer` |
| 11 | +- `Switch` |
| 12 | +- `Actions` |
| 13 | +- `NavBar` |
| 14 | + |
| 15 | +## Router: |
| 16 | +| Property | Type | Default | Description | |
| 17 | +|---------------|----------|--------------|----------------------------------------------------------------| |
| 18 | +| reducer | `function` | | optional user-defined reducer for scenes, you may want to use it to intercept all actions and put your custom logic | |
| 19 | +| 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| |
| 20 | +| other props | | | all properties that will be passed to all your scenes | |
| 21 | +| children | | required (if no scenes property passed)| Scene root element | |
| 22 | +| 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 | |
| 23 | +| getSceneStyle | `function` | optional | Optionally override the styles for NavigationCard's Animated.View rendering the scene. | |
| 24 | + |
| 25 | +## Scene: |
| 26 | + |
| 27 | +| Property | Type | Default | Description | |
| 28 | +|-----------|--------|---------|--------------------------------------------| |
| 29 | +| key | `string` | required | Will be used to call screen transition, for example, `Actions.name(params)`. Must be unique. | |
| 30 | +| component | `React.Component` | semi-required | The `Component` to be displayed. Not required when defining a nested `Scene`, see example. If it is defined for 'container' scene, it will be used as custom container `renderer` | |
| 31 | +| initial | `bool` | false | Set to `true` if this is the initial scene | |
| 32 | +| type | `string` | 'push' or 'jump' | Defines how the new screen is added to the navigator stack. One of `push`, `jump`, `replace`, `reset`. If parent container is tabbar (tabs=true), jump will be automatically set. |
| 33 | +| clone | `bool` | | Scenes marked with `clone` will be treated as templates and cloned into the current scene's parent when pushed. See example. | |
| 34 | + |
| 35 | +### Animation |
| 36 | +| Property | Type | Default | Description | |
| 37 | +|-----------|--------|---------|--------------------------------------------| |
| 38 | +| duration | `number` | | optional. acts as a shortcut to writing an `applyAnimation` function with `Animated.timing` for a given duration (in ms). | |
| 39 | +| direction | `string` | 'horizontal' | direction of animation horizontal/vertical | |
| 40 | +| applyAnimation | `function` | | optional if provided overrides the default spring animation | |
| 41 | + |
| 42 | +### Scene styles |
| 43 | +| Property | Type | Default | Description | |
| 44 | +|-----------|--------|---------|--------------------------------------------| |
| 45 | +| sceneStyle | [`View style`](https://facebook.github.io/react-native/docs/view.html#style) | { flex: 1 } | optional style override for the Scene's component | |
| 46 | +| getSceneStyle | `function` | optional | Optionally override the styles for NavigationCard's Animated.View rendering the scene. | |
| 47 | + |
| 48 | +### Tabs |
| 49 | +| Property | Type | Default | Description | |
| 50 | +|-----------|--------|---------|--------------------------------------------| |
| 51 | +| 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. |
| 52 | +| tabBarStyle | [`View style`](https://facebook.github.io/react-native/docs/view.html#style) | | optional style override for the Tabs component | |
| 53 | +| hideTabBar | `bool` | false | hides tab bar for this scene (if built-in TabBar component is used as parent renderer)| |
| 54 | + |
| 55 | +### Navigation Bar |
| 56 | +| Property | Type | Default | Description | |
| 57 | +|-----------|--------|---------|--------------------------------------------| |
| 58 | +| hideNavBar | `bool` | false | hides the navigation bar for this scene | |
| 59 | +| navigationBarStyle | [`View style`](https://facebook.github.io/react-native/docs/view.html#style) | | optional style override for the navigation bar | |
| 60 | +| navBar | `React.Component` | | optional custom NavBar for the scene. Check built-in NavBar of the component for reference | |
| 61 | +| drawerImage | [`Image source`](https://facebook.github.io/react-native/docs/image.html#source) | `'./menu_burger.png'` | Simple way to override the drawerImage in the navBar | |
| 62 | + |
| 63 | +#### Navigation Bar: Title |
| 64 | +| Property | Type | Default | Description | |
| 65 | +|-----------|--------|---------|--------------------------------------------| |
| 66 | +| title | `string` | null | The title to be displayed in the navigation bar | |
| 67 | +| getTitle | `function` | optional | Optionally closure to return a value of the title based on state | |
| 68 | +| renderTitle | `function` | optional | Optionally closure to render the title | |
| 69 | +| titleStyle | [`Text style`](https://facebook.github.io/react-native/docs/text.html#style) | | optional style override for the title element | |
| 70 | + |
| 71 | +#### Navigation Bar: Back button |
| 72 | +| Property | Type | Default | Description | |
| 73 | +|-----------|--------|---------|--------------------------------------------| |
| 74 | +| backTitle | `string` | | optional string to display with back button | |
| 75 | +| renderBackButton | `function` | | optional closure to render back text or button if this route happens to be the previous route | |
| 76 | +| backButtonImage | [`Image source`](https://facebook.github.io/react-native/docs/image.html#source) | `'./back_chevron.png'` | Simple way to override the back button in the navBar | |
| 77 | +| backButtonTextStyle | [`Text style`](https://facebook.github.io/react-native/docs/text.html#style) | | optional style override for the back title element | |
| 78 | + |
| 79 | +#### Navigation Bar: Left button |
| 80 | +| Property | Type | Default | Description | |
| 81 | +|-----------|--------|---------|--------------------------------------------| |
| 82 | +| leftTitle | `string` | | optional string to display on the left if the previous route does not provide `renderBackButton` prop. `renderBackButton` > `leftTitle` > <previous route's `title`> | |
| 83 | +| renderLeftButton | `function` | | optional closure to render the left title / buttons element | |
| 84 | +| onLeft | `function` | | function will be called when left navBar button is pressed | |
| 85 | +| leftButtonImage | [`Image source`](https://facebook.github.io/react-native/docs/image.html#source) | | Image for left button | |
| 86 | +| leftButtonIconStyle | [`View style`](https://facebook.github.io/react-native/docs/view.html#style) | | Image style for left button | |
| 87 | +| leftButtonStyle | [`View style`](https://facebook.github.io/react-native/docs/view.html#style) | | optional style override for the container of left title / buttons | |
| 88 | +| leftButtonTextStyle | [`Text style`](https://facebook.github.io/react-native/docs/text.html#style) | | optional style override for the left title element | |
| 89 | + |
| 90 | +#### Navigation Bar: Right button |
| 91 | +| Property | Type | Default | Description | |
| 92 | +|-----------|--------|---------|--------------------------------------------| |
| 93 | +| rightTitle | `string` | | optional string to display on the right. `onRight` must be provided for this to appear. | |
| 94 | +| renderRightButton | `function` | | optional closure to render the right title / buttons element | |
| 95 | +| onRight | `function` | | function will be called when right navBar button is pressed | |
| 96 | +| rightButtonImage | [`Image source`](https://facebook.github.io/react-native/docs/image.html#source) | | Image for right button | |
| 97 | +| rightButtonIconStyle | [`View style`](https://facebook.github.io/react-native/docs/view.html#style) | | Image style for right button | |
| 98 | +| rightButtonStyle | [`View style`](https://facebook.github.io/react-native/docs/view.html#style) | | optional style override for the container of right title / buttons | |
| 99 | +| rightButtonTextStyle | [`Text style`](https://facebook.github.io/react-native/docs/text.html#style) | | optional style override for the right title element | |
| 100 | +| **...other props** | | | all properties that will be passed to your component instance | |
0 commit comments