File tree Expand file tree Collapse file tree
packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818
1919using namespace facebook ::react;
2020
21- inline static TextAlignment RCTResolveTextAlignment (TextAlignment textAlignment, LayoutDirection layoutDirection )
21+ inline static TextAlignment RCTResolveTextAlignment (TextAlignment textAlignment, bool isRTL )
2222{
23- const bool isRTL = layoutDirection == LayoutDirection::RightToLeft;
2423 switch (textAlignment) {
24+ case TextAlignment::Natural:
25+ return isRTL ? TextAlignment::Right : TextAlignment::Left;
2526 case TextAlignment::Start:
2627 return isRTL ? TextAlignment::Right : TextAlignment::Left;
2728 case TextAlignment::End:
@@ -212,10 +213,10 @@ inline static CGFloat RCTEffectiveFontSizeMultiplierFromTextAttributes(const Tex
212213 // Paragraph Style
213214 NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new ];
214215 BOOL isParagraphStyleUsed = NO ;
215- if ( textAttributes.alignment . has_value ()) {
216- TextAlignment textAlignment = RCTResolveTextAlignment (
217- textAttributes. alignment . value_or (TextAlignment::Natural),
218- textAttributes.layoutDirection .value_or (LayoutDirection::LeftToRight) );
216+ const bool isRTL = textAttributes.layoutDirection == LayoutDirection::RightToLeft;
217+ if (textAttributes. alignment . has_value () || isRTL) {
218+ TextAlignment textAlignment =
219+ RCTResolveTextAlignment ( textAttributes.alignment .value_or (TextAlignment::Natural), isRTL );
219220
220221 paragraphStyle.alignment = RCTNSTextAlignmentFromTextAlignment (textAlignment);
221222 isParagraphStyleUsed = YES ;
You can’t perform that action at this time.
0 commit comments