Skip to content

[iOS] Resolve natural text alignment from the layout direction for LTR as well as RTL - #59249

Open
qutrek wants to merge 2 commits into
react:mainfrom
qutrek:fix/ios-natural-alignment-ltr
Open

qutrek wants to merge 2 commits into
react:mainfrom
qutrek:fix/ios-natural-alignment-ltr

Conversation

@qutrek

@qutrek qutrek commented Oct 20, 2026 •

Copy link
Copy Markdown

Summary

0.88 made Text with no textAlign align to the right when the layout direction is RTL, which matches Android. That check only runs when the direction is RTL, so for LTR the paragraph style is left alone and iOS falls back to its own "natural" alignment. iOS works that out from the language it picked for the process, not from the layout direction React Native is using.

This shows up in apps that ship more than one language and let people choose it in the app. On an iPhone set to Arabic, with the app set to English (I18nManager.isRTL is false, the layout is LTR), every Text without textAlign is right-aligned inside a left-to-right layout. Android doesn't have this problem.

This change runs the same resolution whenever a layout direction is set, so natural alignment follows the layout direction both ways. Text with an explicit textAlign is not affected, and RTL behaves as it does today.

Changelog:

[IOS] [FIXED] - Natural text alignment follows the layout direction for LTR text, not the process language

Test Plan:

Our app on 0.88.0 (built from source), iOS 27 simulator with the device language set to Arabic, app set to English, I18nManager.isRTL false:

  • Without the change, the labels and descriptions on a settings screen (Text without textAlign) are right-aligned while the rows, icons and switches are laid out left to right.
  • With the change, the same text is left-aligned. Nothing else on the screen moves.
  • With the app in Arabic (RTL), text is right-aligned with the change, as before (the RTL path takes the same branch it took already).

We carry this as a patch in our app's current test builds. Happy to add screenshots.

@meta-cla

meta-cla Bot commented Oct 20, 2026

Copy link
Copy Markdown

Hi @qutrek!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Oct 21, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@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 Oct 21, 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 Oct 21, 2026
@@ -219,7 +219,7 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
BOOL isParagraphStyleUsed = NO;
const bool isRTL = textAttributes.layoutDirection == LayoutDirection::RightToLeft;

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.

Move inside the if

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Done, thanks.

@meta-codesync

meta-codesync Bot commented Oct 21, 2026

Copy link
Copy Markdown

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

This branch has not been deployed

No deployments
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. 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.

2 participants