Skip to content

Commit

Permalink
Fixed a bug when <Text> does not redraw native view on relayout
Browse files Browse the repository at this point in the history
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 7d1ec7a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Libraries/Text/Text/RCTTextShadowView.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7d1ec7a

Please sign in to comment.