Skip to content

Add logical border width and inline border color props - #59996

Merged
meta-codesync[bot] merged 4 commits into
react:mainfrom
zoontek:logical-border-width-color
Nov 20, 2026
Merged

meta-codesync[bot] merged 4 commits into
react:mainfrom
zoontek:logical-border-width-color

Conversation

@zoontek

@zoontek zoontek commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

Summary:

#59404 wants to stop swapping left / right in RTL, so direction-aware borders need all logical properties support.

borderBlock*Color is already supported, but borderBlockWidth, borderBlockStartWidth and borderBlockEndWidth are ignored. The inline equivalents don't exist.

This PR adds borderBlockWidth, borderBlockStartWidth, borderBlockEndWidth, borderInlineWidth, borderInlineStartWidth, borderInlineEndWidth, borderInlineColor, borderInlineStartColor and borderInlineEndColor support.

Changelog:

[GENERAL] [ADDED] - Add borderBlockWidth, borderBlockStartWidth, borderBlockEndWidth, borderInlineWidth, borderInlineStartWidth, borderInlineEndWidth, borderInlineColor, borderInlineStartColor and borderInlineEndColor style props

Test 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:

iOS Android

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 13, 2026
@github-actions

Copy link
Copy Markdown

Warning

JavaScript API change detected

This PR commits an update to ReactNativeApi.d.ts, indicating a change to React Native's public JavaScript API.

  • Please include a clear changelog message.
  • This change will be subject to additional review.

This change was flagged as: POTENTIALLY_BREAKING

@zoontek
zoontek force-pushed the logical-border-width-color branch from 80f0dad to c33a7dd Compare November 13, 2026 14:16
@zoontek zoontek changed the title Logical border width color Add logical border width and inline border color props Nov 13, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Nov 13, 2026

@intergalacticspacehighway intergalacticspacehighway left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM 👍

# Conflicts:
#	packages/react-native/ReactNativeApi.d.ts

# Conflicts:
#	packages/react-native/ReactNativeApi.d.ts
@zoontek
zoontek force-pushed the logical-border-width-color branch from d63628e to 3fd277b Compare November 17, 2026 10:25
@meta-codesync

meta-codesync Bot commented Nov 17, 2026

Copy link
Copy Markdown

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this in D132538487.

@meta-codesync
meta-codesync Bot merged commit 647bffa into react:main Nov 20, 2026
46 of 47 checks passed
@react-native-bot react-native-bot added the Merged This PR has been merged. label Nov 20, 2026
@react-native-bot

Copy link
Copy Markdown
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
@react-native-bot

Copy link
Copy Markdown
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?

@zoontek
zoontek deleted the logical-border-width-color branch November 23, 2026 11:38
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged. p: Expo Partner: Expo Partner Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants