mirror of
https://github.com/zhigang1992/react-navigation.git
synced 2026-02-11 22:33:32 +08:00
Add Syntax highlighting to Redux-Integration.md (#2355)
* Add Syntax highlighting to Redux-Integration.md * Update Redux-Integration.md
This commit is contained in:
@@ -4,7 +4,7 @@ To handle your app's navigation state in redux, you can pass your own `navigatio
|
||||
|
||||
With redux, your app's state is defined by a reducer. Each navigation router effectively has a reducer, called `getStateForAction`. The following is a minimal example of how you might use navigators within a redux application:
|
||||
|
||||
```js
|
||||
```es6
|
||||
import { addNavigationHelpers } from 'react-navigation';
|
||||
|
||||
const AppNavigator = StackNavigator(AppRouteConfigs);
|
||||
@@ -61,7 +61,7 @@ Navigation state is automatically passed down from one navigator to another when
|
||||
|
||||
Applying this to the example above, you could instead define `AppNavigator` to contain a nested `TabNavigator` as follows:
|
||||
|
||||
```js
|
||||
```es6
|
||||
const AppNavigator = StackNavigator({
|
||||
Home: { screen: MyTabNavigator },
|
||||
});
|
||||
@@ -77,7 +77,8 @@ There's a working example app with redux [here](https://github.com/react-communi
|
||||
|
||||
To make jest tests work with your react-navigation app, you need to change the jest preset in the `package.json`, see [here](https://facebook.github.io/jest/docs/tutorial-react-native.html#transformignorepatterns-customization):
|
||||
|
||||
```JSON
|
||||
|
||||
```json
|
||||
"jest": {
|
||||
"preset": "react-native",
|
||||
"transformIgnorePatterns": [
|
||||
@@ -90,7 +91,7 @@ To make jest tests work with your react-navigation app, you need to change the j
|
||||
|
||||
By using the following snippet, your nav component will be aware of the back button press actions and will correctly interact with your stack. This is really useful on Android.
|
||||
|
||||
```js
|
||||
```es6
|
||||
import React from "react";
|
||||
import { BackHandler } from "react-native";
|
||||
import { addNavigationHelpers, NavigationActions } from "react-navigation";
|
||||
|
||||
Reference in New Issue
Block a user