Repository navigation
Conversation
|
Warning JavaScript API change detected This PR commits an update to
This change was flagged as: |
cortinico
reviewed
Oct 23, 2026
This branch has not been deployed
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:
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).localeIdentifieron both platforms, in BCP 47 format (en-US) - same format asnavigator.languageon web.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.plist[ANDROID] [CHANGED] -
I18nManager.getConstants().localeIdentifieruses BCP 47 format (en-USinstead ofen_US)Test 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