From 535210ca15d5f8880c999f0d804a4a21e44d4042 Mon Sep 17 00:00:00 2001 From: Nick Lefever Date: Fri, 5 Sep 2025 07:50:04 -0700 Subject: [PATCH] Use int32_t for color representation on Android Summary: This was originally changed from signed to unsigned here: D81230050. But because Android UI's `Color.valueOf` function uses a signed integer, we need to pass signed values to the android view when defining colors. See https://www.internalfb.com/code/fbsource/xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/bridge/ColorPropConverter.kt?lines=82-82 The color value has to be between Integer.MIN_VALUE and Integer.MAX_VALUE. When passing an unsigned value, the value gets capped to the max signed value and results in another color being represented. Changelog: [Internal] Reviewed By: rshest Differential Revision: D81779878 --- .../android/react/renderer/graphics/HostPlatformColor.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/HostPlatformColor.h b/packages/react-native/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/HostPlatformColor.h index e4f0e259443..9752be6b7f0 100644 --- a/packages/react-native/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/HostPlatformColor.h +++ b/packages/react-native/ReactCommon/react/renderer/graphics/platform/android/react/renderer/graphics/HostPlatformColor.h @@ -12,7 +12,7 @@ namespace facebook::react { -using Color = uint32_t; +using Color = int32_t; namespace HostPlatformColor { constexpr facebook::react::Color UndefinedColor = 0;