Skip to content

Commit 326b79f

Browse files
committed
Document 'type' property for routers
1 parent 7c7b5e0 commit 326b79f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

docs/custom-routers.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ The router is responsible for handling actions dispatched by calling methods on
1010

1111
You can make your own router by building an object with the following functions:
1212

13+
- `type` - String representing the type of the router, e.g. `'stack'`, `'tab'`, `'drawer'` etc.
1314
- `getInitialState` - Function which returns the initial state for the navigator. Receives an options object with `routeNames` and `routeParamList` properties.
1415
- `getRehydratedState` - Function which rehydrates the full navigation state from a given partial state. Receives a partial state object and an options object with `routeNames` and `routeParamList` properties.
1516
- `getStateForRouteNamesChange` - Function which takes the current state and updated list of route names, and returns a new state. Receives the state object and an options object with `routeNames` and `routeParamList` properties.
@@ -22,6 +23,8 @@ Example:
2223

2324
```js
2425
const router = {
26+
type: 'tab',
27+
2528
getInitialState({ routeNames, routeParamList }) {
2629
const index =
2730
options.initialRouteName === undefined
@@ -30,6 +33,7 @@ const router = {
3033

3134
return {
3235
stale: false,
36+
type: 'tab',
3337
key: shortid(),
3438
index,
3539
routeNames,
@@ -67,6 +71,7 @@ const router = {
6771

6872
return {
6973
stale: false,
74+
type: 'tab',
7075
key: shortid(),
7176
index:
7277
typeof state.index === 'number' && state.index < routes.length

0 commit comments

Comments
 (0)