Repository navigation
Add logical border width and inline border color props - #59996
Merged
meta-codesync[bot] merged 4 commits intoNov 20, 2026
Merged
Conversation
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
zoontek
force-pushed
the
logical-border-width-color
branch
from
November 13, 2026 14:16
80f0dad to
c33a7dd
Compare
intergalacticspacehighway
approved these changes
Nov 14, 2026
intergalacticspacehighway
left a comment
Collaborator
There was a problem hiding this comment.
LGTM 👍
cipolleschi
approved these changes
Nov 17, 2026
# Conflicts: # packages/react-native/ReactNativeApi.d.ts # Conflicts: # packages/react-native/ReactNativeApi.d.ts
zoontek
force-pushed
the
logical-border-width-color
branch
from
November 17, 2026 10:25
d63628e to
3fd277b
Compare
|
@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D132538487. |
Collaborator
|
This pull request was successfully merged by @zoontek in 647bffa When will my fix make it into a release? | How to file a pick request? |
1 similar comment
Collaborator
|
This pull request was successfully merged by @zoontek in 647bffa When will my fix make it into a release? | How to file a pick request? |
meta-codesync Bot
pushed a commit
that referenced
this pull request
Dec 4, 2026
…al edges ## Summary: This proposes a change of behavior, not a bug fix: when a style sets both `paddingTop` and `paddingBlockStart` (or `paddingBottom` and `paddingBlockEnd`), the block-axis longhand wins instead of the physical edge. Today the two axes disagree. `applyAliasedProps` applies `paddingBlockStart` and `paddingBlockEnd` only when `paddingTop` and `paddingBottom` are undefined, while `paddingInlineStart` sets Yoga's `Start` edge, which Yoga resolves before `Left` (`Style::computeLeftEdge`), so it already wins over `paddingLeft`. The block-axis order comes from #35342, which gave "precedence to specific edges" and described Yoga's precedence as "left > start > horizontal > all". But for padding Yoga resolved `start` before `left` then (`YGNode::computeEdgeValueForRow` at `67b8e182fa`) and does today, as #41682 notes. This change makes the block axis match the inline one. Yoga has no block-start or block-end edge, so the longhands replace the physical edges in `applyAliasedProps`. ### Web parity On the web, `padding-top` and `padding-block-start` set the same side in a horizontal writing mode, and the later declaration wins. React Native flattens styles by key, so no declaration order reaches layout, and neither rule matches the web in every case: | Style | Web | `main` | This change | | --- | --- | --- | --- | | `paddingTop: 0` then `paddingBlockStart: 8` | 8 | 0 | 8 | | `paddingBlockStart: 8` then `paddingTop: 0` | 0 | 0 | 8 | So this does not improve web parity in general; it changes which order matches. It gives one rule for padding on both axes: the logical longhand wins over the physical edge. ### Motivation A component library compiled with StyleX for React Native carries `paddingTop: 0` from a reset beside a component's `paddingBlockStart: 8`. React Native applies the 0, and a button is laid out 22 points tall where its design is 38. ### Scope This changes padding only. `marginBlockStart`/`marginBlockEnd`, `insetBlockStart`/`insetBlockEnd` and `borderBlockStartWidth`/`borderBlockEndWidth` still give the physical edge precedence; #59996 gave the border widths that order, and Android's `BorderInsets.kt` follows it. If the direction is right, they should follow; this PR is limited to padding to settle the direction first. The shorthands keep their place: `paddingBlock` sets Yoga's `Vertical` edge, which `paddingTop` and `paddingBottom` still override, as `paddingLeft` overrides `paddingInline` (`Horizontal`). ## Changelog: [GENERAL] [CHANGED] - `paddingBlockStart` and `paddingBlockEnd` take precedence over `paddingTop` and `paddingBottom`, as `paddingInlineStart` and `paddingInlineEnd` do over `paddingLeft` and `paddingRight` ## Test Plan: ```sh yarn fantom packages/react-native/Libraries/Components/View/__tests__/View-paddingBlockLonghands-itest.js ``` The new `View-paddingBlockLonghands-itest.js` lays out a container around a 10×10 child: - `paddingTop: 0, paddingBlockStart: 8, paddingBottom: 0, paddingBlockEnd: 4` puts the child 8 points down in a container 22 tall. On `main` it fails: child at 0, container 10 tall. - `paddingLeft: 0, paddingInlineStart: 8` puts the child 8 points in (passes on `main`: the inline-axis order). - `paddingTop` and `paddingBottom` alone still apply, and `paddingTop: 2, paddingBlock: 8` still gives 2. These pass on this branch, as do `yarn fantom packages/react-native/Libraries/Components/View packages/react-native/Libraries/StyleSheet`, `flow full-check`, ESLint, Prettier and `scripts/clang-format.js --check`. Not run: iOS or Android builds; the change is in shared C++ layout code, which Fantom runs. Differential Revision: D135947739 Pull Request resolved: #60382
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:
#59404 wants to stop swapping
left/rightin RTL, so direction-aware borders need all logical properties support.borderBlock*Coloris already supported, butborderBlockWidth,borderBlockStartWidthandborderBlockEndWidthare ignored. The inline equivalents don't exist.This PR adds
borderBlockWidth,borderBlockStartWidth,borderBlockEndWidth,borderInlineWidth,borderInlineStartWidth,borderInlineEndWidth,borderInlineColor,borderInlineStartColorandborderInlineEndColorsupport.Changelog:
[GENERAL] [ADDED] - Add
borderBlockWidth,borderBlockStartWidth,borderBlockEndWidth,borderInlineWidth,borderInlineStartWidth,borderInlineEndWidth,borderInlineColor,borderInlineStartColorandborderInlineEndColorstyle propsTest Plan:
Flow, TypeScript, Jest and the Android Kotlin compile pass. A local Fantom test checked layout in LTR / RTL, precedence, and view flattening.
An new "Logical Borders" example in RNTester's Border page: