Skip to content

Commit c1d2347

Browse files
committedMay 4, 2018
Add navigation params for web
1 parent c1100fb commit c1d2347

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed
 

‎packages/shared/components/Navigator/AppNavigatorSwitch.web.js

+10-7
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,24 @@ import ROUTES, { initialRouteName } from "../../constants/routes";
44
import { View, Text } from "react-native";
55

66
class AppNavigatorSwitch extends Component {
7-
_navigate(history, path) {
8-
history.push(path);
7+
_navigate(history, path, params) {
8+
history.push({ pathname: path, state: params });
99
}
1010
_goback(history) {
1111
history.goBack();
1212
}
1313
generateNavigation(history) {
1414
return {
15-
navigate: path => {
16-
if(ROUTES[path]) {
17-
this._navigate(history, ROUTES[path].path);
18-
}
15+
navigate: (path, params) => {
16+
if (ROUTES[path]) {
17+
this._navigate(history, ROUTES[path].path, params);
18+
}
1919
},
2020
goBack: () => {
2121
this._goback(history);
22+
},
23+
state: {
24+
params: this.props.location.state
2225
}
2326
};
2427
}
@@ -43,7 +46,7 @@ class AppNavigatorSwitch extends Component {
4346
render() {
4447
const { history } = this.props;
4548
return (
46-
<Switch>
49+
<Switch>
4750
{this.generateRoutes(history)}
4851
<Route
4952
component={() => (

0 commit comments

Comments
 (0)
Please sign in to comment.