@jobber/components-native 0.70.1-CLEANUPex-e95f16e.2 → 0.71.0
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components-native",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.71.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "React Native implementation of Atlantis",
|
|
6
6
|
"repository": {
|
|
@@ -82,5 +82,5 @@
|
|
|
82
82
|
"react-native-safe-area-context": "^4.5.2",
|
|
83
83
|
"react-native-svg": ">=12.0.0"
|
|
84
84
|
},
|
|
85
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "05bf7ab30a2c51d195e6250ad2757f0bf8d8e696"
|
|
86
86
|
}
|
package/src/utils/meta/meta.json
CHANGED
|
@@ -19,6 +19,7 @@ describe("meta", () => {
|
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
+
// NOTE: Keep this in sync with components/src/utils/meta/meta.test.tsx
|
|
22
23
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
23
24
|
function isComponent(name: string, value: any): boolean {
|
|
24
25
|
const isFirstLetterUppercase = /^[A-Z]/.test(name);
|
|
@@ -27,6 +28,7 @@ function isComponent(name: string, value: any): boolean {
|
|
|
27
28
|
return isFirstLetterUppercase && isFunctionComponent;
|
|
28
29
|
}
|
|
29
30
|
|
|
31
|
+
// NOTE: Keep this in sync with components/src/utils/meta/meta.test.tsx
|
|
30
32
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
31
33
|
function isContext(value: any): boolean {
|
|
32
34
|
return (
|
|
@@ -37,6 +39,7 @@ function isContext(value: any): boolean {
|
|
|
37
39
|
);
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
// NOTE: Keep this in sync with components/src/utils/meta/meta.test.tsx
|
|
40
43
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
41
44
|
function isForwardedRef(name: string, value: any): boolean {
|
|
42
45
|
const isFirstLetterUppercase = /^[A-Z]/.test(name);
|
|
@@ -49,6 +52,22 @@ function isForwardedRef(name: string, value: any): boolean {
|
|
|
49
52
|
);
|
|
50
53
|
}
|
|
51
54
|
|
|
55
|
+
// NOTE: Keep this in sync with components/src/utils/meta/meta.test.tsx
|
|
56
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
57
|
+
function isMemoizedComponent(name: string, value: any): boolean {
|
|
58
|
+
const isFirstLetterUppercase = /^[A-Z]/.test(name);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
isFirstLetterUppercase &&
|
|
62
|
+
value &&
|
|
63
|
+
typeof value === "object" &&
|
|
64
|
+
typeof value.$$typeof === "symbol" &&
|
|
65
|
+
value.$$typeof.toString() === "Symbol(react.memo)" &&
|
|
66
|
+
typeof value.type === "function"
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// NOTE: Keep this in sync with components/src/utils/meta/meta.test.tsx
|
|
52
71
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
53
72
|
function findComponentNamesDeep(objectOrFunction: any, name?: string) {
|
|
54
73
|
const entries = [...Object.entries(objectOrFunction)];
|
|
@@ -56,7 +75,7 @@ function findComponentNamesDeep(objectOrFunction: any, name?: string) {
|
|
|
56
75
|
return entries.reduce<string[]>((allNames, [k, v]) => {
|
|
57
76
|
if (isContext(v)) {
|
|
58
77
|
allNames.push(`${k}.Provider`, `${k}.Consumer`);
|
|
59
|
-
} else if (isForwardedRef(k, v)) {
|
|
78
|
+
} else if (isForwardedRef(k, v) || isMemoizedComponent(k, v)) {
|
|
60
79
|
allNames.push(k);
|
|
61
80
|
} else if (isComponent(k, v)) {
|
|
62
81
|
const thisName = name ? `${name}.${k}` : k;
|