@hero-design/rn 8.92.0 → 8.92.1
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/.turbo/turbo-build.log +2 -2
- package/CHANGELOG.md +6 -0
- package/es/index.js +34 -2
- package/lib/index.js +34 -2
- package/package.json +1 -1
- package/src/components/Select/SingleSelect/OptionList.tsx +6 -5
- package/src/components/Select/SingleSelect/__tests__/OptionList.spec.tsx +24 -0
- package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +594 -0
- package/src/components/Select/SingleSelect/__tests__/index.spec.tsx +26 -0
- package/src/components/Select/SingleSelect/index.tsx +5 -1
- package/src/components/Select/__tests__/helpers.spec.tsx +36 -0
- package/src/components/Select/helpers.tsx +45 -0
- package/stats/8.92.1/rn-stats.html +4844 -0
- package/types/components/Select/SingleSelect/OptionList.d.ts +1 -1
- package/types/components/Select/helpers.d.ts +1 -0
|
@@ -99,3 +99,48 @@ export const useKeyboard = () => {
|
|
|
99
99
|
|
|
100
100
|
return { isKeyboardVisible, keyboardHeight };
|
|
101
101
|
};
|
|
102
|
+
|
|
103
|
+
export const deepCompareValue = <V,>(a: V, b: V): boolean => {
|
|
104
|
+
// Handle strict equality first (handles primitives, null, undefined)
|
|
105
|
+
if (a === b) return true;
|
|
106
|
+
|
|
107
|
+
// Special handling for NaN (NaN !== NaN in JS)
|
|
108
|
+
if (
|
|
109
|
+
typeof a === 'number' &&
|
|
110
|
+
typeof b === 'number' &&
|
|
111
|
+
Number.isNaN(a) &&
|
|
112
|
+
Number.isNaN(b)
|
|
113
|
+
) {
|
|
114
|
+
return false;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// If either is null or undefined (but they are not strictly equal), return false
|
|
118
|
+
if (a == null || b == null) return false;
|
|
119
|
+
|
|
120
|
+
// If types don't match, they can't be equal
|
|
121
|
+
if (typeof a !== typeof b) return false;
|
|
122
|
+
|
|
123
|
+
// Handle array comparison
|
|
124
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
125
|
+
if (a.length !== b.length) return false;
|
|
126
|
+
return a.every((val, index) => deepCompareValue(val, b[index]));
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// If one is array and the other isn't, return false
|
|
130
|
+
if (Array.isArray(a) !== Array.isArray(b)) return false;
|
|
131
|
+
|
|
132
|
+
// Handle object comparison
|
|
133
|
+
if (typeof a === 'object' && typeof b === 'object') {
|
|
134
|
+
const keysA = Object.keys(a) as (keyof V)[];
|
|
135
|
+
const keysB = Object.keys(b) as (keyof V)[];
|
|
136
|
+
|
|
137
|
+
if (keysA.length !== keysB.length) return false;
|
|
138
|
+
|
|
139
|
+
return keysA.every(
|
|
140
|
+
(key) => keysB.includes(key) && deepCompareValue(a[key], b[key])
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// If none of the above conditions matched, they're not equal
|
|
145
|
+
return false;
|
|
146
|
+
};
|