Skip to content

fix: map every logical border property onto a prop React Native reads - #393

Merged
danstepanov merged 1 commit into
nativewind:mainfrom
YevheniiKotyrlo:fix/border-inline-var-shorthand
Dec 3, 2026
Merged

danstepanov merged 1 commit into
nativewind:mainfrom
YevheniiKotyrlo:fix/border-inline-var-shorthand

Conversation

@YevheniiKotyrlo

@YevheniiKotyrlo YevheniiKotyrlo commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

The four logical border cases #581 set aside, on top of #474.

Problem

On main:

  • border-inline-style: var(--tw-border-style) warns. Every Tailwind border-x-* / border-y-* width utility writes a per-edge style through --tw-border-style, so each one logs a warning, although a var() style drops exactly as a solid one does.
  • light-dark() in an edge shorthand sends its dark half to a key React Native lacks. border-inline, border-inline-start/-end and border-block-start/-end address it to the property's own name (borderInline, borderInlineStart, …), so the dark scheme paints nothing new. The renamed longhands (border-inline-start-color, border-inline-end-color) do the same.
  • A var() axis colour holding two colours sets neither edge. border-x-(--c) with --c: red blue puts the whole pair on each edge.
  • var() in border-inline, border-block and their -start/-end forms puts the variable's text on borderInline, borderBlock or their start/end key, none of which React Native reads, so no edge is set.

Solution

Tests

  • src/__tests__/compiler/logical-borders.test.ts: each per-edge style with a var() drops without a warning.
  • src/__tests__/native/logical-borders.test.tsx: a two-colour variable in each axis colour; each var() shorthand reaching the edges it names; a later edge colour over a var() shorthand; the real-key guard over every member with a var() and every colour-bearing member with light-dark(), in both schemes.

Verification

Every CI job passes locally on the head: lint, typecheck, yarn test, the library and web builds, commitlint, and the iOS dev build.

Merge order

Builds on #474, which lands first.

@YevheniiKotyrlo YevheniiKotyrlo changed the title fix(compiler): expand var()-valued border-inline shorthands to start/end fix(compiler): expand var()-valued border-inline shorthands, drop the dead borderInlineStyle key Aug 15, 2026
@YevheniiKotyrlo YevheniiKotyrlo changed the title fix(compiler): expand var()-valued border-inline shorthands, drop the dead borderInlineStyle key fix: map every logical border property onto a prop React Native reads Aug 15, 2026
@YevheniiKotyrlo
YevheniiKotyrlo marked this pull request as ready for review August 15, 2026 19:54
@YevheniiKotyrlo

YevheniiKotyrlo commented Aug 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Device evidence — before / after

UNFIXED — The three-part shorthand row paints no border — expanded from a var(), it sets neither edge. The width-only row above it paints on both builds.

FIXED — Both subject rows have a border on BOTH inline edges, matching the control.

before — 3.1.0-rc.0 after — with this PR

Android 16 emulator (API 36, GLES on the host GPU), 1140×2400 @ 480dpi, both frames from one run. before is the published 3.1.0-rc.0 plus what my test app needs from my other patches to run: the native and native-internal subpath exports, PR 459, cascade-layer ranking, and a shim that compiles a class-qualified :root inert. after adds the rest of my open PRs, this one included. One of them shows on every screen: PR 417 narrows a var()-valued font-family to one family, so the after sets its text in the theme's face where the before falls back to the platform's.

@YevheniiKotyrlo
YevheniiKotyrlo changed the base branch from fix-logical-border-props to main October 11, 2026 12:35
@YevheniiKotyrlo
YevheniiKotyrlo force-pushed the fix/border-inline-var-shorthand branch from d5cc8ca to e36c560 Compare October 11, 2026 12:35
@YevheniiKotyrlo
YevheniiKotyrlo force-pushed the fix/border-inline-var-shorthand branch from e36c560 to 85c6387 Compare October 17, 2026 01:32
danstepanov pushed a commit that referenced this pull request Nov 20, 2026
…tive draws (#581)

Based on #393.

Co-authored-by: Yevhenii <evgeny.kotyrlo@gmail.com>

@sammoore sammoore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this! The core fix has landed in #581: your commit with follow-ups on top, squashed into 0ef4ec8 with you as co-author. border-x-*/border-y-* colours now compile to one declaration per edge (borderStartColor/borderEndColor, borderTopColor/borderBottomColor), so they're drawn on both platforms and a later edge colour wins in cascade order. That fixes the Nativewind v4 regression without #474.

#581 set aside the parts of this PR that doesn't affect Tailwind users, leaving four fixes for this PR. Could you rebase onto main and narrow it to them?

Two are independent of #474 and apply directly to main:

  • Quieting the warning for border-inline-style: var(--tw-border-style), which every border-x-2/border-y-2 triggers. Ideally just a ~3-line warning change.
  • light-dark() in the edge shorthands (border-inline, border-inline-start, border-block-start and so on). It can reuse the descriptorProperties that #581 added.

Two resolve at runtime, so as written they need #474:

  • A var() axis colour holding two colours (--c: red blue in border-x-(--c)). This could work without #474 by keeping #581's one declaration per edge and having each edge pick its colour from the resolved value.
  • var() in border-inline/border-block and their -start/-end forms.

Up to you how you want to group these changes (all in this PR based on #474, or what have you); I'll review them after the next release. The runtime pair can wait for #474 and/or use the per-edge approach above.

@YevheniiKotyrlo
YevheniiKotyrlo marked this pull request as draft November 30, 2026 14:43
@YevheniiKotyrlo
YevheniiKotyrlo force-pushed the fix/border-inline-var-shorthand branch 2 times, most recently from b19d450 to 168b6ff Compare November 30, 2026 16:17
@YevheniiKotyrlo

Copy link
Copy Markdown
Contributor Author

Rebased onto main and narrowed to the four, in one commit on top of #474, which is restacked onto main as well:

@sammoore sammoore left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!!! LGTM

… 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.
@danstepanov
danstepanov force-pushed the fix/border-inline-var-shorthand branch from 683eb44 to 16ba73c Compare December 3, 2026 01:38
@danstepanov
danstepanov merged commit a2095e9 into nativewind:main Dec 3, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants