Skip to content

Commit 2cc049d

Browse files
authored
fix: unexpected expection when style array contains undefined
Currently, when the style prop is an array and contains undefined, it may throw "right operand of 'in' is not an object" for example: https://github.com/react-navigation/react-navigation/blob/main/packages/elements/src/SafeAreaProviderCompat.tsx#L36 https://github.com/expo/expo/blob/main/packages/expo-router/src/views/Unmatched.tsx#L110
1 parent 90a99b0 commit 2cc049d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/runtime/native/react/rules.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ export function updateRules(
7171
if (target) {
7272
if (Array.isArray(target)) {
7373
for (const item of target) {
74+
// undefined is allowed in style array
75+
if (!item) {
76+
continue;
77+
}
7478
if (VAR_SYMBOL in item) {
7579
inlineVariables.add(item);
7680
} else if (

0 commit comments

Comments
 (0)