react-native-boxes 1.4.37 → 1.4.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/utils.ts +18 -8
package/package.json
CHANGED
package/src/utils.ts
CHANGED
|
@@ -11,6 +11,19 @@ function extractPathFromUrl(url: string): string {
|
|
|
11
11
|
return url.substring(pathStartIndex + 1); // +1 to remove leading '/'
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
function extractQueryParams(part: string) {
|
|
15
|
+
if (!part) {
|
|
16
|
+
return {}
|
|
17
|
+
}
|
|
18
|
+
const query = part.split("?")[1];
|
|
19
|
+
const params: any = {};
|
|
20
|
+
const queryParams = query.split("&");
|
|
21
|
+
queryParams?.forEach((pk) => {
|
|
22
|
+
const [key, value] = pk.split("=")
|
|
23
|
+
params[key] = value;
|
|
24
|
+
});
|
|
25
|
+
return params
|
|
26
|
+
}
|
|
14
27
|
export function getNavParamsFromDeeplink(url: string) {
|
|
15
28
|
if (url?.startsWith("/")) {
|
|
16
29
|
url = url.substring(1)
|
|
@@ -35,14 +48,7 @@ export function getNavParamsFromDeeplink(url: string) {
|
|
|
35
48
|
|
|
36
49
|
if (part?.indexOf("?") > -1) {
|
|
37
50
|
cloneObj.screen = part.split("?")[0];
|
|
38
|
-
|
|
39
|
-
const params: any = {};
|
|
40
|
-
const queryParams = query.split("&");
|
|
41
|
-
queryParams?.forEach((pk) => {
|
|
42
|
-
const [key, value] = pk.split("=")
|
|
43
|
-
params[key] = value;
|
|
44
|
-
});
|
|
45
|
-
cloneObj.params = params;
|
|
51
|
+
cloneObj.params = extractQueryParams(part);
|
|
46
52
|
} else {
|
|
47
53
|
cloneObj.screen = part;
|
|
48
54
|
}
|
|
@@ -53,6 +59,10 @@ export function getNavParamsFromDeeplink(url: string) {
|
|
|
53
59
|
}
|
|
54
60
|
}
|
|
55
61
|
rootParams = lastCloneObj;
|
|
62
|
+
} else {
|
|
63
|
+
let qParts = root.split("?")
|
|
64
|
+
rootParams = extractQueryParams(root)
|
|
65
|
+
root = qParts[0]
|
|
56
66
|
}
|
|
57
67
|
return [root, rootParams];
|
|
58
68
|
}
|