Skip to content

Commit 35db604

Browse files
committed
fix(ios): inherit text fonts for inline attachments
1 parent 1449daa commit 35db604

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

  • packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager

‎packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,13 @@ void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText)
415415
attachment.image = placeholderImage;
416416
attachment.bounds = bounds;
417417

418-
return [[NSMutableAttributedString attributedStringWithAttachment:attachment] mutableCopy];
418+
NSMutableAttributedString *attributedString =
419+
[[NSMutableAttributedString attributedStringWithAttachment:attachment] mutableCopy];
420+
UIFont *font = RCTEffectiveFontFromTextAttributes(fragment.textAttributes);
421+
if (font) {
422+
[attributedString addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, attributedString.length)];
423+
}
424+
return attributedString;
419425
} else {
420426
NSString *decoded = [[NSString alloc] initWithBytes:fragment.string.data()
421427
length:fragment.string.size()

0 commit comments

Comments
 (0)