Skip to content

Commit abed3cf

Browse files
jcarreirofacebook-github-bot
authored andcommitted
Revert D5944488: [RN][iOS]: Re-render views when direction changes
Differential Revision: D5944488 fbshipit-source-id: 79e695dcc0ea7d09544ace1525828333a5818c5a
1 parent 9bbc70c commit abed3cf

File tree

6 files changed

+435
-623
lines changed

6 files changed

+435
-623
lines changed

Libraries/Text/RCTShadowText.m

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ @implementation RCTShadowText
3838
CGFloat _cachedTextStorageWidthMode;
3939
NSAttributedString *_cachedAttributedString;
4040
CGFloat _effectiveLetterSpacing;
41-
UIUserInterfaceLayoutDirection _cachedLayoutDirection;
41+
UIUserInterfaceLayoutDirection _cachedEffectiveLayoutDirection;
4242
}
4343

4444
static YGSize RCTMeasure(YGNodeRef node, float width, YGMeasureMode widthMode, float height, YGMeasureMode heightMode)
@@ -72,7 +72,7 @@ - (instancetype)init
7272
_fontSizeMultiplier = 1.0;
7373
_textAlign = NSTextAlignmentNatural;
7474
_writingDirection = NSWritingDirectionNatural;
75-
_cachedLayoutDirection = UIUserInterfaceLayoutDirectionLeftToRight;
75+
_cachedEffectiveLayoutDirection = UIUserInterfaceLayoutDirectionLeftToRight;
7676

7777
YGNodeSetMeasureFunc(self.yogaNode, RCTMeasure);
7878

@@ -198,7 +198,7 @@ - (NSTextStorage *)buildTextStorageForWidth:(CGFloat)width widthMode:(YGMeasureM
198198
_cachedTextStorage &&
199199
(width == _cachedTextStorageWidth || (isnan(width) && isnan(_cachedTextStorageWidth))) &&
200200
widthMode == _cachedTextStorageWidthMode &&
201-
_cachedLayoutDirection == self.layoutDirection
201+
_cachedEffectiveLayoutDirection == self.effectiveLayoutDirection
202202
) {
203203
return _cachedTextStorage;
204204
}
@@ -272,12 +272,12 @@ - (NSAttributedString *)_attributedStringWithFontFamily:(NSString *)fontFamily
272272
if (
273273
![self isTextDirty] &&
274274
_cachedAttributedString &&
275-
_cachedLayoutDirection == self.layoutDirection
275+
_cachedEffectiveLayoutDirection == self.effectiveLayoutDirection
276276
) {
277277
return _cachedAttributedString;
278278
}
279279

280-
_cachedLayoutDirection = self.layoutDirection;
280+
_cachedEffectiveLayoutDirection = self.effectiveLayoutDirection;
281281

282282
if (_fontSize && !isnan(_fontSize)) {
283283
fontSize = @(_fontSize);
@@ -419,7 +419,7 @@ - (void)_setParagraphStyleOnAttributedString:(NSMutableAttributedString *)attrib
419419
// Text alignment
420420
NSTextAlignment textAlign = _textAlign;
421421
if (textAlign == NSTextAlignmentRight || textAlign == NSTextAlignmentLeft) {
422-
if (_cachedLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) {
422+
if (_cachedEffectiveLayoutDirection == UIUserInterfaceLayoutDirectionRightToLeft) {
423423
if (textAlign == NSTextAlignmentRight) {
424424
textAlign = NSTextAlignmentLeft;
425425
} else {

0 commit comments

Comments
 (0)