Repository navigation
fix(native): resolve declarations in cascade order once an element's variables are set - #474
Merged
danstepanov merged 1 commit intoDec 2, 2026
Conversation
This was referenced Oct 11, 2026
Contributor
Author
YevheniiKotyrlo
marked this pull request as ready for review
October 11, 2026 13:42
YevheniiKotyrlo
marked this pull request as draft
October 16, 2026 14:04
YevheniiKotyrlo
marked this pull request as ready for review
October 16, 2026 14:13
YevheniiKotyrlo
marked this pull request as draft
October 17, 2026 01:09
YevheniiKotyrlo
marked this pull request as ready for review
October 17, 2026 03:15
danstepanov
pushed a commit
to sammoore/react-native-css
that referenced
this pull request
Nov 20, 2026
border-inline-color: var(--c) and border-block-color: var(--c) resolved
through a runtime shorthand, which applies after every other declaration
of the element. A later edge colour on a different key then lost to it:
.a { border-inline-color: var(--c) } .b { border-inline-start-color: blue }
painted the start edge --c. Fixing that ordering is nativewind#474's job.
Each axis colour now compiles to one declaration per edge, the shape
border-inline-start-color: var(--c) already has, so a later edge colour
replaces it in cascade order without nativewind#474. Two literal tokens
(var(--a) var(--b), red var(--b)) still split onto start and end.
Dropped: a single var() that substitutes two colours (--c: red blue) no
longer splits; both edges get the list, which React Native's
normalizeColor leaves unset (no throw). Main sent the same list to
borderInlineColor / borderBlockColor. The runtime handler that covered it
is in patches/393-logical-border-color-runtime.patch, to land after nativewind#474.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
danstepanov
pushed a commit
to sammoore/react-native-css
that referenced
this pull request
Nov 20, 2026
border-inline, border-block and their -start / -end forms with a var() went through new runtime handlers. Tailwind emits none of them, and the handlers apply after every other declaration of the element, so until PR nativewind#474 lands a later edge longhand loses to them: .a { border-inline: var(--b) } .b { border-inline-start-color: blue } paints the start edge in --b's colour. Main sends the list to borderInline* untouched, which React Native ignores without throwing. The handlers and their tests are in patches/393-logical-border-shorthand-var.patch, to land after nativewind#474. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
YevheniiKotyrlo
marked this pull request as draft
November 30, 2026 15:28
YevheniiKotyrlo
force-pushed
the
fix/deferred-declarations
branch
from
November 30, 2026 15:39
2507a93 to
400a4ad
Compare
YevheniiKotyrlo
added a commit
to YevheniiKotyrlo/react-native-css
that referenced
this pull request
Nov 30, 2026
… React Native reads - A var() per-edge style, which every Tailwind border-x-* / border-y-* width utility writes through --tw-border-style, drops without a warning, as a solid one does: its value is unknown, not a known non-solid style. - light-dark() in border-inline, border-inline-start/-end and border-block-start/-end sends its dark half to the edge keys its light half lands on, through descriptorProperties, and a renamed longhand names its renamed key. - A var() axis colour holding two colours keeps nativewind#581's one declaration per edge, and each edge picks its own colour from the resolved value. - var() in border-inline, border-block and their -start/-end forms resolves at runtime onto the same edge keys as the literal forms, the style component dropped; with nativewind#474's cascade order a later edge declaration replaces its edge.
YevheniiKotyrlo
added a commit
to YevheniiKotyrlo/react-native-css
that referenced
this pull request
Nov 30, 2026
… React Native reads - A var() per-edge style, which every Tailwind border-x-* / border-y-* width utility writes through --tw-border-style, drops without a warning, as a solid one does: its value is unknown, not a known non-solid style. - light-dark() in border-inline, border-inline-start/-end and border-block-start/-end sends its dark half to the edge keys its light half lands on, through descriptorProperties, and a renamed longhand names its renamed key. - A var() axis colour holding two colours keeps nativewind#581's one declaration per edge, and each edge picks its own colour from the resolved value. - var() in border-inline, border-block and their -start/-end forms resolves at runtime onto the same edge keys as the literal forms, the style component dropped; with nativewind#474's cascade order a later edge declaration replaces its edge.
YevheniiKotyrlo
marked this pull request as ready for review
November 30, 2026 16:33
YevheniiKotyrlo
added a commit
to YevheniiKotyrlo/react-native-css
that referenced
this pull request
Nov 30, 2026
… React Native reads - A var() per-edge style, which every Tailwind border-x-* / border-y-* width utility writes through --tw-border-style, drops without a warning, as a solid one does: its value is unknown, not a known non-solid style. - light-dark() in border-inline, border-inline-start/-end and border-block-start/-end sends its dark half to the edge keys its light half lands on, through descriptorProperties, and so does a colour longhand, renamed or not. - A var() axis colour holding two colours keeps nativewind#581's one declaration per edge, and each edge picks its own colour from the resolved value. - var() in border-inline, border-block and their -start/-end forms resolves at runtime onto the same edge keys as the literal forms, the style component dropped; with nativewind#474's cascade order a later edge declaration replaces its edge.
sammoore
approved these changes
Dec 2, 2026
sammoore
left a comment
Contributor
There was a problem hiding this comment.
Ready to merge as-is. The new current squashed/rebased version of the PR is exactly the same cleanup I ended up with after solving the merge conflicts.
Thank you @YevheniiKotyrlo !!
…ent's variables are assigned A declaration that reads a var() was resolved after the walk, through a placeholder at its key, and only applied if no later declaration replaced the placeholder. A later rule's variable was not yet assigned when an earlier declaration was walked, and the delayed closures shared one target binding across the rule's declarations. Every rule's variables are now assigned before any declaration resolves, and every declaration resolves in cascade order, so a later declaration overwrites an earlier one as the browsers apply them and no placeholder is left. Transform properties keep composing through nativewind#576's records once every rule is walked. A runtime value that resolves to nothing still resets the property.
danstepanov
force-pushed
the
fix/deferred-declarations
branch
from
December 2, 2026 18:29
400a4ad to
c20b2e7
Compare
danstepanov
approved these changes
Dec 2, 2026
danstepanov
pushed a commit
to YevheniiKotyrlo/react-native-css
that referenced
this pull request
Dec 3, 2026
… React Native reads - A var() per-edge style, which every Tailwind border-x-* / border-y-* width utility writes through --tw-border-style, drops without a warning, as a solid one does: its value is unknown, not a known non-solid style. - light-dark() in border-inline, border-inline-start/-end and border-block-start/-end sends its dark half to the edge keys its light half lands on, through descriptorProperties, and so does a colour longhand, renamed or not. - A var() axis colour holding two colours keeps nativewind#581's one declaration per edge, and each edge picks its own colour from the resolved value. - var() in border-inline, border-block and their -start/-end forms resolves at runtime onto the same edge keys as the literal forms, the style component dropped; with nativewind#474's cascade order a later edge declaration replaces its edge.
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
A declaration whose value reads a
var()resolves after every other declaration of its element, through a placeholder left at its key. Two defects onmainfollow from that:applyDeclarations's sharedtargetbinding, so it checked its placeholder against whatever nested target the last declaration ended on, missed it, and left the placeholder in the style.color: var(--c); box-shadow: 1px 1px bluerenderscolor: { color: true },text-shadowdoes the same, and-webkit-line-clamp: var(--n)beside a deferred colour rendersnumberOfLines: { numberOfLines: true }.border: var(--b); border-color: bluepaints the variable's colour, within a rule and across rules.border-inline-width: var(--w)does the same over a laterborder-inline-start-width, an earlier rule'stext-shadow: var(--s)replaces a later rule'stext-shadow, andanimation: var(--a)replaces a lateranimation-duration.Solution
var()substitutes the element's computed custom property (css-variables-1 §3). Then every declaration resolves in cascade order, so a later declaration overwrites an earlier one as browsers apply them, and no placeholder is left.main.Tests
src/__tests__/native/deferred-declarations.test.tsx:borderbefore and afterborder-color, in one rule and across rules,border-inline-widthbeforeborder-inline-start-width, and an earlier rule'stext-shadow: var(--s)before a later rule'stext-shadow;box-shadow;var()with no value, and a written value the runtime cannot read, over an earlier rule's value.src/__tests__/native/animations.test.tsx: a writtenanimation-durationafter a variableanimation, kept for the runtime withinlineVariablesat its default and atfalse.Verification
Every CI job passes locally on the head: lint, typecheck,
yarn test, the library and web builds, commitlint, and the iOS dev build.Device evidence, before and after: #474 (comment)
Merge order
#393 and #501 build on this, so this lands first.
It shares lines with #391, #411 and #488 (
native/styles/calculate-props.ts); whichever lands second rebases. With #391, a declaration avar()leaves invalid at computed-value time resolves tounset, so the second of the two to land keeps that and drops this removal for a runtime value that resolves to nothing, which leaves one the runtime cannot read ignored.