Skip to content

Commit 73426e8

Browse files
hilkeheremansgrabbou
authored andcommitted
Add clarification for Redux <-> Nested Navigators (react-navigation#26)
* Add clarification for Redux <-> Nested Navigators See also react-navigation#16 * Update per comments * Update per comments in PR react-navigation#26
1 parent fe968c2 commit 73426e8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

docs/guides/Redux-Integration.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,18 @@ class App extends React.Component {
4141
}
4242
```
4343

44-
Now, your navigation state is stored with redux, and you can fire navigation actions using redux.
44+
Once you do this, your navigation state is stored within your redux store, at which point you can fire navigation actions using your redux dispatch function.
4545

46-
When a navigator is given a `navigation` prop, it relinquishes control of the state. So you are now responsible for persisting state, handling deep linking, integrating the back button, etc.
46+
Keep in mind that when a navigator is given a `navigation` prop, it relinquishes control of its internal state. That means you are now responsible for persisting its state, handling any deep linking, integrating the back button, etc.
47+
48+
Navigation state is automatically passed down from one navigator to another when you nest them. Note that in order for a child navigator to receive the state from a parent navigator, it should be defined as a `screen`.
49+
50+
Applying this to the example above, you could instead define `AppNavigator` to contain a nested `TabNavigator` as follows:
51+
52+
```js
53+
const AppNavigator = StackNavigator({
54+
Home: { screen: MyTabNavigator },
55+
});
56+
```
57+
58+
In this case, once you `connect` `AppNavigator` to Redux as is done in `AppWithNavigationState`, `MyTabNavigator` will automatically have access to navigation state as a `navigation` prop.

0 commit comments

Comments
 (0)