Repository navigation
fix(native): seed a concrete scheme-aware __rn-css-color on every platform - #392
Open
YevheniiKotyrlo wants to merge 1 commit into
Open
YevheniiKotyrlo wants to merge 1 commit into
YevheniiKotyrlo wants to merge 1 commit into
Conversation
YevheniiKotyrlo
marked this pull request as ready for review
July 26, 2026 14:52
Contributor
Author
…tform The root seed is `color`'s initial value, `CanvasText`: black, or white in a dark scheme. A semantic `PlatformColor` fallback paints nothing on the border, ring and shadow paths of either platform, so the seed is a concrete color chosen by the root's own `prefers-color-scheme` evaluation. Every currentcolor consumer is pinned on the compile-time and runtime paths in both schemes, from raw CSS and from Tailwind's own utilities.
YevheniiKotyrlo
force-pushed
the
fix/root-color-seed
branch
from
October 11, 2026 12:35
d3047d5 to
859dc9e
Compare
This was referenced Oct 11, 2026
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.


Problem
Every color that falls back to the root
__rn-css-colorpaints nothing where the platform reads it without resolving a semantic color — everywhere on Android, and on iOS for border, outline and shadow. Tailwind v4's default ring color iscurrentcolor, soring,inset-ring,text-currentandborder-currentare the everyday triggers.Root cause
?attr/textColorPrimaryis a ColorStateList, andColorPropConverter.resolveThemeAttributereturnsoutValue.datawithout checkingoutValue.type, so the paint receives a resource reference rather than a color.UIColorhas to be resolved against a trait collection.RCTViewComponentView.mmdoes that for the background alone; border, outline and shadow read.CGColordirectly (facebook/react-native#57836).Solution
The seed is
color's initial value,CanvasText(CSS Color 4 §3.2), made concrete: black, or white underprefers-color-scheme: dark. The root observable already evaluates a seeded value's media query againstcolorScheme, so the seed stays reactive with noPlatform.OSbranch, noAppearancelistener, noas anyand no eslint suppression. An ancestor's color or a:rootcolor still overrides it.Tests
src/__tests__/native/root-color-seed.test.tsx— each of 13currentcolorconsumers compiles to the root color reference and paints#000000in a light scheme and#FFFFFFin a dark one; no preference, a live scheme change, an ancestor color, a:rootcolor and a scheme-conditioned:rootcolor are pinned as well.src/__tests__/vendor/tailwind/current-color.test.tsx— Tailwind's owncurrentcolorutilities (text-current,bg-current,border-current,outline-current,decoration-current,caret-current,fill-current,stroke-current,ring,inset-ring,shadow-current,placeholder:text-current) in both schemes, and an explicit ring color over the default.src/__tests__/native/box-shadow.test.tsx— aplatformColor()shadow still reaches the shadow as the platform's object.PlatformColordescriptor for acurrentcolorreader now assert the painted color.On
main, 56 cases fail with thePlatformColorseed and all of them pass with this one.Verification
On Windows with Node 26:
yarn lintclean ·yarn typecheckclean ·yarn test --maxWorkers=2 --coverage1401 passed, 4 failed — the babel cases that fail onmainon this machine ·yarn buildclean ·yarn example expo export --platform webexported · nothing unstaged after either build. Not run: the iOS dev build.Device evidence, before and after: #392 (comment)
Open question
?attr/colorForegroundpoints at a plain<color>in AppCompat and Material, so it would resolve correctly and keep a custom brand theme's foreground instead of pure black or white. I chose the concrete pair because it is what CSS specifies and whatlight-dark()compiles to here; switching needs a device check I have not run.Related
#410 makes the root registries process-global while
colorSchemestays per module copy, so a media-conditioned seed binds to whichever copy evaluated first; #427 guardsreactivity.ts's observables the same way. Both editsrc/native-internal/root.ts.Merge order
This overlaps #410; I'll re-cut whichever of the two lands second.
It also shares lines with #412 (
native-internal/root.ts); whichever lands second rebases.Base
Re-applied onto
main(a5002c5). Two expectations follow whatmaindoes: it mapsborder-inline-start-colortoborderStartColor, and writes acolor-mix()shadow color asrgba().