mirror of
https://github.com/status-im/react-navigation.git
synced 2025-02-24 17:18:09 +00:00
fix 2953 (#2976)
This commit is contained in:
parent
fafe68b8cb
commit
44616dd45a
@ -30,6 +30,14 @@ function _getUuid() {
|
|||||||
return `${uniqueBaseId}-${uuidCount++}`;
|
return `${uniqueBaseId}-${uuidCount++}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isEmpty(obj: ?Object): boolean {
|
||||||
|
if (!obj) return true;
|
||||||
|
for (let key in obj) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
export default (
|
export default (
|
||||||
routeConfigs: NavigationRouteConfigMap,
|
routeConfigs: NavigationRouteConfigMap,
|
||||||
stackConfig: NavigationStackRouterConfig = {}
|
stackConfig: NavigationStackRouterConfig = {}
|
||||||
@ -375,17 +383,17 @@ export default (
|
|||||||
|
|
||||||
// reduce the items of the query string. any query params may
|
// reduce the items of the query string. any query params may
|
||||||
// be overridden by path params
|
// be overridden by path params
|
||||||
const queryParams =
|
const queryParams = !isEmpty(inputParams)
|
||||||
inputParams ||
|
? inputParams
|
||||||
(queryString || '').split('&').reduce((result: *, item: string) => {
|
: (queryString || '').split('&').reduce((result: *, item: string) => {
|
||||||
if (item !== '') {
|
if (item !== '') {
|
||||||
const nextResult = result || {};
|
const nextResult = result || {};
|
||||||
const [key, value] = item.split('=');
|
const [key, value] = item.split('=');
|
||||||
nextResult[key] = value;
|
nextResult[key] = value;
|
||||||
return nextResult;
|
return nextResult;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}, null);
|
}, null);
|
||||||
|
|
||||||
// reduce the matched pieces of the path into the params
|
// reduce the matched pieces of the path into the params
|
||||||
// of the route. `params` is null if there are no params.
|
// of the route. `params` is null if there are no params.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user