Skip to content

Set the media features from the iOS and Android color scheme - #60125

Open
intergalacticspacehighway wants to merge 1 commit into
media-queries-1-corefrom
media-queries-2-platforms
Open

intergalacticspacehighway wants to merge 1 commit into
media-queries-1-corefrom
media-queries-2-platforms

Conversation

@intergalacticspacehighway

@intergalacticspacehighway intergalacticspacehighway commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Summary:

This is PR 2 of 3 (RFC). Stack: #60124 (core) → this PR → #60126 (types and example).

This PR connects the platform color scheme to the media features from PR 1. On both platforms, the first value is set before the first surface starts, so the first render already uses it. Each later change calls setMediaFeatures, which commits each surface. Conditional styles use the same color scheme as useColorScheme(), including the app's overrides.

  • iOS:
    • RCTSurfacePresenter sends the color scheme to Fabric (-[RCTScheduler setMediaFeatures:]): once at start, then on each RCTUserInterfaceStyleDidChangeNotification.
    • It reads the scheme with RCTColorSchemePreference, the same function as RCTAppearance, so the app's appearance settings (such as RCTOverrideAppearancePreference) apply.
    • RCTColorSchemePreference moves unchanged from React-CoreModules to React-Core (React/Modules/RCTAppearancePreference), so Fabric needs no new pod dependency. This is the same split as RCTI18nUtil. RCTAppearance.h imports the new header, so existing imports still work.
  • Android:
    • Fabric starts with the current uiMode.
    • AppearanceModule sends each new color scheme, including the app's OverrideColorScheme, to the new FabricUIManager.setMediaFeatures (@UnstableReactNativeAPI).

Appearance.setColorScheme() works on both platforms, because it changes the window style (iOS) or the activity configuration (Android).

Changelog:

[IOS] [ADDED] - Conditional style values follow the color scheme.
[ANDROID] [ADDED] - Conditional style values follow the color scheme.

Test Plan:

  • gh pr checkout 60126 (includes all 3 PRs), build RNTester on Android and iOS, and open Media Queries.
  • The conditional styles follow system scheme changes, Appearance.setColorScheme(), and native overrides (OverrideColorScheme, RCTOverrideAppearancePreference) with no React render, and match useColorScheme().
Light Dark
Android image image
iOS image image

@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 Nov 18, 2026
@intergalacticspacehighway
intergalacticspacehighway force-pushed the media-queries-2-platforms branch 2 times, most recently from 7941f82 to 549754e Compare November 19, 2026 04:27
@intergalacticspacehighway intergalacticspacehighway added the p: Expo Partner: Expo label Nov 19, 2026
@intergalacticspacehighway
intergalacticspacehighway marked this pull request as ready for review November 19, 2026 05:18

This branch has not been deployed

No deployments
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. p: Expo Partner: Expo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant