Skip to content

Commit 7d1ec7a

Browse files
sherginfacebook-github-bot
authored andcommittedJan 26, 2018
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
1 parent 2a3c37f commit 7d1ec7a

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
 

‎Libraries/Text/Text/RCTTextShadowView.m

+15
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,21 @@ - (NSTextStorage *)textStorageAndLayoutManagerThatFitsSize:(CGSize)size
235235
return textStorage;
236236
}
237237

238+
- (void)applyLayoutNode:(YGNodeRef)node
239+
viewsWithNewFrame:(NSMutableSet<RCTShadowView *> *)viewsWithNewFrame
240+
absolutePosition:(CGPoint)absolutePosition
241+
{
242+
if (YGNodeGetHasNewLayout(self.yogaNode)) {
243+
// If the view got new layout, we have to redraw it because `contentFrame`
244+
// and sizes of embedded views may change.
245+
_needsUpdateView = YES;
246+
}
247+
248+
[super applyLayoutNode:node
249+
viewsWithNewFrame:viewsWithNewFrame
250+
absolutePosition:absolutePosition];
251+
}
252+
238253
- (void)applyLayoutWithFrame:(CGRect)frame
239254
layoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection
240255
viewsWithUpdatedLayout:(NSMutableSet<RCTShadowView *> *)viewsWithUpdatedLayout

0 commit comments

Comments
 (0)