Skip to content

Use int32_t for color representation on Android#53621

Open
lenaic wants to merge 1 commit intofacebook:mainfrom
lenaic:export-D81779878
Open

Use int32_t for color representation on Android#53621
lenaic wants to merge 1 commit intofacebook:mainfrom
lenaic:export-D81779878

Conversation

@lenaic
Copy link

@lenaic lenaic commented Sep 5, 2025

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

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
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 5, 2025
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81779878

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants