Skip to content

Commit 365b2d5

Browse files
committed
fix getStateFromPath - second working solution
1 parent 57509ac commit 365b2d5

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

patches/react-navigation/@react-navigation+core+7.10.0+getStateFromPath.patch renamed to patches/react-navigation/@react-navigation+core+7.10.0+002+getStateFromPath.patch

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
diff --git a/node_modules/@react-navigation/core/lib/module/getStateFromPath.js b/node_modules/@react-navigation/core/lib/module/getStateFromPath.js
2-
index 7132844..e296919 100644
2+
index 7132844..8af0a15 100644
33
--- a/node_modules/@react-navigation/core/lib/module/getStateFromPath.js
44
+++ b/node_modules/@react-navigation/core/lib/module/getStateFromPath.js
55
@@ -29,31 +29,23 @@ import { validatePathConfig } from "./validatePathConfig.js";
@@ -144,20 +144,22 @@ index 7132844..e296919 100644
144144
if (routes !== undefined) {
145145
// This will always be empty if full path matched
146146
current = createNestedStateObject(path, routes, initialRoutes, configs);
147-
@@ -241,6 +309,12 @@ function getConfigsWithRegexes(configs) {
147+
@@ -241,6 +309,14 @@ function getConfigsWithRegexes(configs) {
148148
regex: c.regex ? new RegExp(c.regex.source + '$') : undefined
149149
}));
150150
}
151+
+
151152
+const joinPaths = function () {
152153
+ for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) {
153154
+ paths[_key] = arguments[_key];
154155
+ }
155156
+ return [].concat(...paths.map(p => p.split('/'))).filter(Boolean).join('/');
156157
+};
158+
+
157159
const matchAgainstConfigs = (remaining, configs) => {
158160
let routes;
159161
let remainingPath = remaining;
160-
@@ -254,37 +328,34 @@ const matchAgainstConfigs = (remaining, configs) => {
162+
@@ -254,37 +330,34 @@ const matchAgainstConfigs = (remaining, configs) => {
161163

162164
// If our regex matches, we need to extract params from the path
163165
if (match) {
@@ -214,7 +216,7 @@ index 7132844..e296919 100644
214216
break;
215217
}
216218
}
217-
@@ -293,61 +364,34 @@ const matchAgainstConfigs = (remaining, configs) => {
219+
@@ -293,61 +366,34 @@ const matchAgainstConfigs = (remaining, configs) => {
218220
remainingPath
219221
};
220222
};
@@ -293,7 +295,7 @@ index 7132844..e296919 100644
293295
}
294296
if (config.screens) {
295297
// property `initialRouteName` without `screens` has no purpose
296-
@@ -358,7 +402,7 @@ const createNormalizedConfigs = (screen, routeConfig, initials, paths, parentScr
298+
@@ -358,7 +404,7 @@ const createNormalizedConfigs = (screen, routeConfig, initials, paths, parentScr
297299
});
298300
}
299301
Object.keys(config.screens).forEach(nestedConfig => {
@@ -302,7 +304,7 @@ index 7132844..e296919 100644
302304
configs.push(...result);
303305
});
304306
}
305-
@@ -366,41 +410,27 @@ const createNormalizedConfigs = (screen, routeConfig, initials, paths, parentScr
307+
@@ -366,41 +412,27 @@ const createNormalizedConfigs = (screen, routeConfig, initials, paths, parentScr
306308
routeNames.pop();
307309
return configs;
308310
};

0 commit comments

Comments
 (0)