diff --git a/Libraries/Text/Text/RCTTextShadowView.m b/Libraries/Text/Text/RCTTextShadowView.m index 20293c733ba560..cdd2c7199782f0 100644 --- a/Libraries/Text/Text/RCTTextShadowView.m +++ b/Libraries/Text/Text/RCTTextShadowView.m @@ -290,6 +290,9 @@ - (void)layoutSubviewsWithContext:(RCTLayoutContext)layoutContext RCTRoundPixelValue(attachmentSize.width), RCTRoundPixelValue(attachmentSize.height) }}; + + NSRange truncatedGlyphRange = [layoutManager truncatedGlyphRangeInLineFragmentForGlyphAtIndex:range.location]; + BOOL viewIsTruncated = NSIntersectionRange(range, truncatedGlyphRange).length != 0; RCTLayoutContext localLayoutContext = layoutContext; localLayoutContext.absolutePosition.x += frame.origin.x; @@ -300,9 +303,11 @@ - (void)layoutSubviewsWithContext:(RCTLayoutContext)layoutContext layoutDirection:self.layoutMetrics.layoutDirection layoutContext:localLayoutContext]; - // Reinforcing a proper frame origin for the Shadow View. RCTLayoutMetrics localLayoutMetrics = shadowView.layoutMetrics; - localLayoutMetrics.frame.origin = frame.origin; + localLayoutMetrics.frame.origin = frame.origin; // Reinforcing a proper frame origin for the Shadow View. + if (viewIsTruncated) { + localLayoutMetrics.displayType = RCTDisplayTypeNone; + } [shadowView layoutWithMetrics:localLayoutMetrics layoutContext:localLayoutContext]; } ]; diff --git a/React/Modules/RCTUIManager.m b/React/Modules/RCTUIManager.m index 217c43a481b24f..2464920d1db78e 100644 --- a/React/Modules/RCTUIManager.m +++ b/React/Modules/RCTUIManager.m @@ -490,6 +490,7 @@ - (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView * UIUserInterfaceLayoutDirection layoutDirection; BOOL isNew; BOOL parentIsNew; + RCTDisplayType displayType; } RCTFrameData; // Construct arrays then hand off to main thread @@ -507,6 +508,7 @@ - (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView * layoutMetrics.layoutDirection, shadowView.isNewView, shadowView.superview.isNewView, + layoutMetrics.displayType }; } } @@ -568,6 +570,7 @@ - (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView * RCTLayoutAnimation *updatingLayoutAnimation = isNew ? nil : layoutAnimationGroup.updatingLayoutAnimation; BOOL shouldAnimateCreation = isNew && !frameData.parentIsNew; RCTLayoutAnimation *creatingLayoutAnimation = shouldAnimateCreation ? layoutAnimationGroup.creatingLayoutAnimation : nil; + BOOL isHidden = frameData.displayType == RCTDisplayTypeNone; void (^completion)(BOOL) = ^(BOOL finished) { completionsCalled++; @@ -583,6 +586,10 @@ - (RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(RCTRootShadowView * if (view.reactLayoutDirection != layoutDirection) { view.reactLayoutDirection = layoutDirection; } + + if (view.isHidden != isHidden) { + view.hidden = isHidden; + } if (creatingLayoutAnimation) {