Skip to content

Commit aa48c0f

Browse files
authored
Merge pull request react-navigation#132 from endoooo/1.x
Support for children Stack and Drawer navigators in custom navigator example
2 parents eb8dc7f + 963e132 commit aa48c0f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

docs/custom-navigators.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,17 @@ A navigator is any React component that has a [router](https://github.com/react-
1010
class MyNavigator extends React.Component {
1111
static router = MyRouter;
1212
render() {
13-
const { state, dispatch } = this.props.navigation;
13+
const { state, dispatch, addListener } = this.props.navigation;
1414
const { routes, index } = state;
1515

1616
// Figure out what to render based on the navigation state and the router:
1717
const Component = MyRouter.getComponentForState(state);
1818

1919
// The state of the active child screen can be found at routes[index]
20-
let childNavigation = { dispatch, state: routes[index] };
20+
let childNavigation = { dispatch, addListener, state: routes[index] };
2121
// If we want, we can also tinker with the dispatch function here, to limit
2222
// or augment our children's actions
23+
// addListener is needed to support children Stack and Drawer navigators
2324

2425
// Assuming our children want the convenience of calling .navigate() and so on,
2526
// we should call addNavigationHelpers to augment our navigation prop:

0 commit comments

Comments
 (0)