@react-navigation/core
Advanced tools
Comparing version 3.0.0-alpha.11 to 3.0.0-alpha.12
@@ -12,3 +12,3 @@ "use strict"; | ||
var childrenNavigationCache = navigation._childrenNavigation ? navigation._childrenNavigation : {}; | ||
var childrenNavigationCache = navigation._childrenNavigation || (navigation._childrenNavigation = {}); | ||
var childKeys = navigation.state.routes.map(route => route.key); | ||
@@ -21,3 +21,3 @@ Object.keys(childrenNavigationCache).forEach(cacheKey => { | ||
return childrenNavigationCache; | ||
return navigation._childrenNavigation; | ||
} |
@@ -56,2 +56,3 @@ 'use strict'; | ||
(0, _validateRouteConfigMap2.default)(routeConfigs); | ||
var childRouters = {}; | ||
@@ -88,5 +89,3 @@ var routeNames = Object.keys(routeConfigs); | ||
if (childRouter !== null) { | ||
var childAction = action.action || _NavigationActions2.default.init({ | ||
params: getParamsForRouteAndAction(initialRouteName, action) | ||
}); | ||
var childAction = action.action || _NavigationActions2.default.init({ params: action.params }); | ||
childState = childRouter.getStateForAction(childAction); | ||
@@ -99,3 +98,3 @@ } | ||
routes: [_extends({ | ||
params: getParamsForRouteAndAction(action.routeName, action.params) | ||
params: action.params | ||
}, childState, { | ||
@@ -111,8 +110,6 @@ key: action.key || (0, _KeyGenerator.generateKey)(), | ||
routeName: initialRouteName, | ||
params: _extends({}, routeConfigs[initialRouteName].params, initialRouteParams) | ||
params: initialRouteParams | ||
})); | ||
} | ||
var params = (routeConfigs[initialRouteName].params || route.params || action.params || initialRouteParams) && _extends({}, routeConfigs[initialRouteName].params, route.params || {}, action.params || {}, initialRouteParams || {}); | ||
var params = (route.params || action.params || initialRouteParams) && _extends({}, route.params || {}, action.params || {}, initialRouteParams || {}); | ||
var { initialRouteKey } = stackConfig; | ||
@@ -131,11 +128,2 @@ route = _extends({}, route, params ? { params } : {}, { | ||
function getParamsForRouteAndAction(routeName, action) { | ||
var routeConfig = routeConfigs[routeName]; | ||
if (routeConfig && routeConfig.params) { | ||
return _extends({}, routeConfig.params, action.params); | ||
} else { | ||
return action.params; | ||
} | ||
} | ||
var { | ||
@@ -270,3 +258,3 @@ getPathAndParamsForRoute, | ||
routes[lastRouteIndex] = _extends({}, _route2, { | ||
params: _extends({}, routeConfigs[_route2.routeName].params, _route2.params, action.params) | ||
params: _extends({}, _route2.params, action.params) | ||
}); | ||
@@ -283,5 +271,3 @@ } | ||
if (_childRouter) { | ||
var _childAction = action.action || _NavigationActions2.default.init({ | ||
params: getParamsForRouteAndAction(action.routeName, action) | ||
}); | ||
var _childAction = action.action || _NavigationActions2.default.init({ params: action.params }); | ||
_route = _extends({ | ||
@@ -295,3 +281,3 @@ params: action.params | ||
_route = { | ||
params: getParamsForRouteAndAction(action.routeName, action), | ||
params: action.params, | ||
routeName: action.routeName, | ||
@@ -377,5 +363,3 @@ key: action.key || (0, _KeyGenerator.generateKey)() | ||
if (_childRouter3) { | ||
var _childAction2 = action.action || _NavigationActions2.default.init({ | ||
params: getParamsForRouteAndAction(action.routeName, action) | ||
}); | ||
var _childAction2 = action.action || _NavigationActions2.default.init({ params: action.params }); | ||
childState = _childRouter3.getStateForAction(_childAction2); | ||
@@ -382,0 +366,0 @@ } |
{ | ||
"name": "@react-navigation/core", | ||
"version": "3.0.0-alpha.11", | ||
"version": "3.0.0-alpha.12", | ||
"description": "Core utilities for the react-navigation framework", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -6,5 +6,4 @@ export default function getChildrenNavigationCache(navigation) { | ||
let childrenNavigationCache = navigation._childrenNavigation | ||
? navigation._childrenNavigation | ||
: {}; | ||
let childrenNavigationCache = | ||
navigation._childrenNavigation || (navigation._childrenNavigation = {}); | ||
let childKeys = navigation.state.routes.map(route => route.key); | ||
@@ -17,3 +16,3 @@ Object.keys(childrenNavigationCache).forEach(cacheKey => { | ||
return childrenNavigationCache; | ||
return navigation._childrenNavigation; | ||
} |
@@ -27,2 +27,3 @@ import NavigationActions from '../NavigationActions'; | ||
validateRouteConfigMap(routeConfigs); | ||
const childRouters = {}; | ||
@@ -61,6 +62,3 @@ const routeNames = Object.keys(routeConfigs); | ||
const childAction = | ||
action.action || | ||
NavigationActions.init({ | ||
params: getParamsForRouteAndAction(initialRouteName, action), | ||
}); | ||
action.action || NavigationActions.init({ params: action.params }); | ||
childState = childRouter.getStateForAction(childAction); | ||
@@ -74,3 +72,3 @@ } | ||
{ | ||
params: getParamsForRouteAndAction(action.routeName, action.params), | ||
params: action.params, | ||
...childState, | ||
@@ -88,12 +86,7 @@ key: action.key || generateKey(), | ||
routeName: initialRouteName, | ||
params: { | ||
...routeConfigs[initialRouteName].params, | ||
...initialRouteParams, | ||
}, | ||
params: initialRouteParams, | ||
}) | ||
); | ||
} | ||
const params = (routeConfigs[initialRouteName].params || route.params || action.params || initialRouteParams) && { | ||
...(routeConfigs[initialRouteName].params), | ||
const params = (route.params || action.params || initialRouteParams) && { | ||
...(route.params || {}), | ||
@@ -103,3 +96,2 @@ ...(action.params || {}), | ||
}; | ||
const { initialRouteKey } = stackConfig; | ||
@@ -120,11 +112,2 @@ route = { | ||
function getParamsForRouteAndAction(routeName, action) { | ||
let routeConfig = routeConfigs[routeName]; | ||
if (routeConfig && routeConfig.params) { | ||
return { ...routeConfig.params, ...action.params }; | ||
} else { | ||
return action.params; | ||
} | ||
} | ||
const { | ||
@@ -309,3 +292,2 @@ getPathAndParamsForRoute, | ||
params: { | ||
...routeConfigs[route.routeName].params, | ||
...route.params, | ||
@@ -330,6 +312,3 @@ ...action.params, | ||
const childAction = | ||
action.action || | ||
NavigationActions.init({ | ||
params: getParamsForRouteAndAction(action.routeName, action), | ||
}); | ||
action.action || NavigationActions.init({ params: action.params }); | ||
route = { | ||
@@ -344,3 +323,3 @@ params: action.params, | ||
route = { | ||
params: getParamsForRouteAndAction(action.routeName, action), | ||
params: action.params, | ||
routeName: action.routeName, | ||
@@ -440,5 +419,3 @@ key: action.key || generateKey(), | ||
action.action || | ||
NavigationActions.init({ | ||
params: getParamsForRouteAndAction(action.routeName, action), | ||
}); | ||
NavigationActions.init({ params: action.params }); | ||
childState = childRouter.getStateForAction(childAction); | ||
@@ -445,0 +422,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
317308
9384