Skip to content
This repository was archived by the owner on Feb 25, 2020. It is now read-only.

Commit d08670a

Browse files
committed
Include route params when initializing stack
1 parent 921047b commit d08670a

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/routers/StackRouter.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ export default (routeConfigs, stackConfig = {}) => {
8484
})
8585
);
8686
}
87-
const params = (route.params || action.params || initialRouteParams) && {
87+
const params = (routeConfigs[initialRouteName].params || route.params || action.params || initialRouteParams) && {
88+
...(routeConfigs[initialRouteName].params || {}),
8889
...(route.params || {}),
8990
...(action.params || {}),
9091
...(initialRouteParams || {}),
@@ -104,6 +105,15 @@ export default (routeConfigs, stackConfig = {}) => {
104105
};
105106
}
106107

108+
function getParamsForRouteAndAction(routeName, action) {
109+
let routeConfig = routeConfigs[routeName];
110+
if (routeConfig && routeConfig.params) {
111+
return { ...routeConfig.params, ...action.params };
112+
} else {
113+
return action.params;
114+
}
115+
}
116+
107117
const {
108118
getPathAndParamsForRoute,
109119
getActionForPathAndParams,

0 commit comments

Comments
 (0)