Skip to content

Support PlatformColor for StatusBar backgroundColor on Android#56540

Open
qflen wants to merge 1 commit into
facebook:mainfrom
qflen:fix/statusbar-platformcolor-48402
Open

Support PlatformColor for StatusBar backgroundColor on Android#56540
qflen wants to merge 1 commit into
facebook:mainfrom
qflen:fix/statusbar-platformcolor-48402

Conversation

@qflen
Copy link
Copy Markdown
Contributor

@qflen qflen commented Apr 21, 2026

Summary

Fixes #48402.

Passing a PlatformColor(...) value to StatusBar.backgroundColor on Android currently throws Unexpected color given in StatusBar._updatePropsStack.

The failure happens because processColor returns an object for PlatformColor, while the StatusBar TurboModule only accepts numeric colors through setColor.

This change adds a setColorObject TurboModule method that accepts a {resource_paths: Array<string>} payload and resolves it natively via ColorPropConverter.getColor.

StatusBar._updatePropsStack now dispatches to:

  • setColor for numeric colors
  • setColorObject for PlatformColor values

To avoid duplicating behavior, the shared animation and color-application logic is moved into a private applyStatusBarColor helper.

Changelog:

[Android] [Fixed] - Allow PlatformColor values to be used with StatusBar.backgroundColor

Test Plan

  • yarn jest packages/react-native/Libraries/Components/StatusBar
  • yarn flow focus-check on StatusBar.js and the spec
  • yarn eslint
  • yarn prettier --check

@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 Apr 21, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Apr 21, 2026
@qflen qflen force-pushed the fix/statusbar-platformcolor-48402 branch 2 times, most recently from bcd35d0 to fe10146 Compare May 24, 2026 15:26
Passing a PlatformColor to StatusBar.backgroundColor previously tripped
an invariant in _updatePropsStack because processColor returns an object
for PlatformColor and the native setColor TurboModule only accepted a
number.

Adds a setColorObject TurboModule method that accepts a resource-paths
object and resolves it on the native side via ColorPropConverter.getColor.
StatusBar.js now dispatches to setColor for numeric colors and to
setColorObject for PlatformColor values.

Fixes facebook#48402
@qflen qflen force-pushed the fix/statusbar-platformcolor-48402 branch from fe10146 to c7982b4 Compare May 24, 2026 15:40
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. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Unexpected color given in StatusBar._updatePropsStack when using PlatformColor for theming

1 participant