Repository navigation
Conversation
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
6958723 to
7fc01f0
Compare
## 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: <img width="345" height="670" alt="iOS" src="https://github.com/user-attachments/assets/b177c0cc-3353-4cb7-b77e-6ff8cdff286c" /> <img width="349" height="652" alt="Android" src="https://github.com/user-attachments/assets/7bc77924-b1cd-4f43-9a15-be575cae2e55" /> Differential Revision: D132538487 Pull Request resolved: #59996
7fc01f0 to
ee2c648
Compare
5737063 to
ef03542
Compare
dc533b0 to
cf247aa
Compare
javache
left a comment
There was a problem hiding this comment.
Will this change be safe if you have an older native client running a newer JS bundle?
d2e01c5 to
06fb00e
Compare
|
@javache Mostly
The rest is compatible: every method the new JS calls still exists on older native, and |
javache
left a comment
There was a problem hiding this comment.
Could we split this into three PRs so each can be made backwards-compatible and tested independently?
- Style cleanup: Move directional styles to
start/endwithout changing layout behaviour. - Runtime
forceRTL(): Update JS state only when native returns a boolean; preserve the legacy restart behaviour otherwise. - Native RTL changes: Remove native mirroring, but keep reporting and honouring the swap flag in JS for older binaries. Otherwise,
SafeAreaViewcan pad the wrong edge in RTL. Document the new iOSRCTSupportsRTLopt-in in this PR.
|
@javache I can split it. One change to the order: runtime
Is it OK for you? |
|
Sounds good, thanks! |
f9ad32c to
c5a9586
Compare
c5a9586 to
0d7e079
Compare
|
@javache Here they are:
Let me know if you need a rebase between each merge. |
The RFC
Summary:
This is a proposal to simplify / cleanup
I18nManager. It contains multiple breaking changes, and it's obviously open to discussion.I started working on it as the current API is messy / hard to grasp:
android:supportsRtlin the manifest andallowRTLat runtime) but only one on iOS (allowRTL), so the platforms do not match.allowRTL,forceRTLandswapLeftAndRightInRTLare saved to disk and only take effect after a restart. They act as app configuration written from JS.margin-leftstays on the left in RTL and only logical properties (margin-inline-start) follow the direction.This PR:
forceRTLapply at runtime: surfaces relayout, andisRTLupdates immediately (bridgeless only). The value is no longer persisted.left/rightare always physical, like on the web. Usestart/endfor direction-aware styles (already supported for a while).RCTSupportsRTLin Info.plist on iOS,android:supportsRtlon Android (unchanged).trueby default.allowRTL,swapLeftAndRightInRTLanddoLeftAndRightSwapInRTL(no-ops with a warning).Changelog:
[GENERAL] [BREAKING] -
I18nManager:forceRTLapplies at runtime and is no longer persisted,left/rightstyles are no longer swapped in RTL,allowRTLandswapLeftAndRightInRTLare deprecated[IOS] [BREAKING] - RTL requires
RCTSupportsRTLset totrueinInfo.plistTest Plan:
Commands I ran, and their results:
yarn flow-check: 0 errorsyarn build-types && yarn test-generated-typescript: passedyarn test packages/react-native/Libraries packages/jest-preset: passedpython -m scripts.cxx-api.parser --validate: all snapshots matchyarn format-check-cpp,yarn format-check-kotlin: cleanVideos:
RNTester's RTL example toggles
forceRTLwithout a reload:RTL.-.Android.mp4
RTL.-.iOS.mp4