Skip to content
Permalink
Browse files

Fixed a bug when <Text> does not redraw native view on relayout

Summary: `contentFrame` is now always provided by shadow thread (with attributed string and embedded views), so we have to update it on every single relayout.

Reviewed By: yungsters

Differential Revision: D6817401

fbshipit-source-id: c2a1f314f34a2187053eb11ce0744c935edbb8ae
  • Loading branch information...
shergin authored and facebook-github-bot committed Jan 26, 2018
1 parent 2a3c37f commit 7d1ec7a3dc66654b13a8e9cb3ddf912e92506f55
Showing with 15 additions and 0 deletions.
  1. +15 −0 Libraries/Text/Text/RCTTextShadowView.m
@@ -235,6 +235,21 @@ - (NSTextStorage *)textStorageAndLayoutManagerThatFitsSize:(CGSize)size
return textStorage;
}

- (void)applyLayoutNode:(YGNodeRef)node
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
absolutePosition:(CGPoint)absolutePosition
{
if (YGNodeGetHasNewLayout(self.yogaNode)) {
// If the view got new layout, we have to redraw it because `contentFrame`
// and sizes of embedded views may change.
_needsUpdateView = YES;
}

[super applyLayoutNode:node
viewsWithNewFrame:viewsWithNewFrame
absolutePosition:absolutePosition];
}

- (void)applyLayoutWithFrame:(CGRect)frame
layoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection
viewsWithUpdatedLayout:(NSMutableSet<RCTShadowView *> *)viewsWithUpdatedLayout

0 comments on commit 7d1ec7a

Please sign in to comment.
You can’t perform that action at this time.