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
This commit is contained in:
Valentin Shergin 2018-01-25 21:13:38 -08:00 committed by Facebook Github Bot
parent 2a3c37f424
commit 7d1ec7a3dc

View File

@ -235,6 +235,21 @@
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