Repository navigation
Add types and an RNTester example for conditional style values - #60126
Open
intergalacticspacehighway wants to merge 1 commit into
Open
intergalacticspacehighway wants to merge 1 commit into
intergalacticspacehighway wants to merge 1 commit into
Conversation
This was referenced Nov 18, 2026
intergalacticspacehighway
force-pushed
the
media-queries-3-types-example
branch
from
November 18, 2026 18:25
eeb8789 to
1e6965a
Compare
intergalacticspacehighway
force-pushed
the
media-queries-3-types-example
branch
from
November 19, 2026 03:51
1e6965a to
df201fd
Compare
intergalacticspacehighway
force-pushed
the
media-queries-3-types-example
branch
from
November 19, 2026 04:27
df201fd to
b7a0b53
Compare
intergalacticspacehighway
marked this pull request as ready for review
November 19, 2026 05:18
intergalacticspacehighway
force-pushed
the
media-queries-3-types-example
branch
from
November 19, 2026 05:22
b7a0b53 to
0605966
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
This is PR 3 of 3 (RFC). Stack: #60124 (core) → #60125 (platforms) → this PR.
This PR adds Flow and TypeScript types for conditional style values, and an RNTester example.
StyleSheet.createandStylePropaccept a conditional value for a style prop:{default: value, '@media (prefers-color-scheme: dark)': value}. The new types areConditionalStyleValue<T>andWithConditionalStyleValues<T>.objectFit,resizeMode,tintColor,userSelectandverticalAligndo not accept conditional values yet, because components convert them in JS.StyleSheet.flatten, a style value can be aConditionalStyleValue. Code that reads it must handle the object (for example,.default) or cast.width.yarn flow-checkofAnimatedExports.jstakes about 12 s instead of 9.5 s.Changelog:
[GENERAL] [BREAKING] - A style value from
StyleSheet.flattencan be aConditionalStyleValue(types only).Test Plan:
stylesheet-conditional-values.tsx(correct usage and expected errors).yarn build-types(no diff inReactNativeApi.d.ts),yarn test-generated-typescript,yarn flow-check, ESLint and Prettier: pass.gh pr checkout 60126, build RNTester, and open Media Queries. The screenshots are in PR 2.