Repository navigation
Conversation
|
Hi @qutrek! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
|
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
| @@ -219,7 +219,7 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex | |||
| NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new]; | |||
| BOOL isParagraphStyleUsed = NO; | |||
| const bool isRTL = textAttributes.layoutDirection == LayoutDirection::RightToLeft; | |||
|
@javache has imported this pull request. If you are a Meta employee, you can view this in D126698053. |
Summary
0.88 made
Textwith notextAlignalign 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.isRTLis false, the layout is LTR), everyTextwithouttextAlignis 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
textAlignis 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.isRTLfalse:TextwithouttextAlign) are right-aligned while the rows, icons and switches are laid out left to right.We carry this as a patch in our app's current test builds. Happy to add screenshots.