diff --git a/Libraries/Text/Text/RCTTextShadowView.m b/Libraries/Text/Text/RCTTextShadowView.m index b47aa3919c36b0..a9fa9136292aed 100644 --- a/Libraries/Text/Text/RCTTextShadowView.m +++ b/Libraries/Text/Text/RCTTextShadowView.m @@ -177,6 +177,12 @@ - (void)postprocessAttributedText:(NSMutableAttributedString *)attributedText - (NSAttributedString *)attributedTextWithMeasuredAttachmentsThatFitSize:(CGSize)size { + static UIImage *placeholderImage; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + placeholderImage = [UIImage new]; + }); + NSMutableAttributedString *attributedText = [[NSMutableAttributedString alloc] initWithAttributedString:[self attributedTextWithBaseTextAttributes:nil]]; @@ -195,6 +201,7 @@ - (NSAttributedString *)attributedTextWithMeasuredAttachmentsThatFitSize:(CGSize maximumSize:size]; NSTextAttachment *attachment = [NSTextAttachment new]; attachment.bounds = (CGRect){CGPointZero, fittingSize}; + attachment.image = placeholderImage; [attributedText addAttribute:NSAttachmentAttributeName value:attachment range:range]; } ];