Skip to content

Commit a06017c

Browse files
fix: Do not process PlatformColor (#8553)
## Summary ## Test plan
1 parent b94e3a2 commit a06017c

File tree

1 file changed

+12
-0
lines changed
  • packages/react-native-reanimated/src/common/style/processors

1 file changed

+12
-0
lines changed

packages/react-native-reanimated/src/common/style/processors/colors.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ export function PlatformColor(...names: Array<string>): PlatformColorValue {
3333
return mapped as PlatformColorValue;
3434
}
3535

36+
function isPlatformColorObject(value: any): boolean {
37+
return (
38+
value &&
39+
typeof value === 'object' &&
40+
(('semantic' in value && Array.isArray(value.semantic)) ||
41+
('resource_paths' in value && Array.isArray(value.resource_paths)))
42+
);
43+
}
44+
3645
/* copied from:
3746
* https://github.com/facebook/react-native/blob/v0.81.0/packages/react-native/Libraries/StyleSheet/PlatformColorValueTypesIOS.d.ts
3847
*/
@@ -118,6 +127,9 @@ export function processColorsInProps(props: StyleProps) {
118127
: undefined;
119128
}
120129
props[key] = processed;
130+
} else if (isPlatformColorObject(value)) {
131+
// PlatformColor is not processed further on iOS and Android
132+
props[key] = value;
121133
} else {
122134
props[key] = processColor(value);
123135
}

0 commit comments

Comments
 (0)