From 35db60440fc95b3d55159bf002520fdedaefff15 Mon Sep 17 00:00:00 2001 From: MJ Studio Date: Fri, 9 Oct 2026 21:17:23 +0900 Subject: [PATCH 1/2] fix(ios): inherit text fonts for inline attachments --- .../renderer/textlayoutmanager/RCTAttributedTextUtils.mm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm index 95ff5a0d180e..24c945321db2 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTAttributedTextUtils.mm @@ -415,7 +415,13 @@ void RCTApplyBaselineOffset(NSMutableAttributedString *attributedText) attachment.image = placeholderImage; attachment.bounds = bounds; - return [[NSMutableAttributedString attributedStringWithAttachment:attachment] mutableCopy]; + NSMutableAttributedString *attributedString = + [[NSMutableAttributedString attributedStringWithAttachment:attachment] mutableCopy]; + UIFont *font = RCTEffectiveFontFromTextAttributes(fragment.textAttributes); + if (font) { + [attributedString addAttribute:NSFontAttributeName value:font range:NSMakeRange(0, attributedString.length)]; + } + return attributedString; } else { NSString *decoded = [[NSString alloc] initWithBytes:fragment.string.data() length:fragment.string.size() From 47c1e8c0b0ab6f994b55b3510ed614f114fd753c Mon Sep 17 00:00:00 2001 From: MJ Studio Date: Sat, 10 Oct 2026 02:48:32 +0900 Subject: [PATCH 2/2] fix(ios): apply baseline offsets to inline view layout --- .../renderer/textlayoutmanager/RCTTextLayoutManager.mm | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm index 33306db54922..62b5f4b720f5 100644 --- a/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm +++ b/packages/react-native/ReactCommon/react/renderer/textlayoutmanager/platform/ios/react/renderer/textlayoutmanager/RCTTextLayoutManager.mm @@ -643,13 +643,15 @@ - (TextMeasurement)_measureTextStorage:(NSTextStorage *)textStorage CGRect glyphRect = [layoutManager boundingRectForGlyphRange:range inTextContainer:textContainer]; CGRect frame; - UIFont *font = [[textStorage attributedSubstringFromRange:range] attribute:NSFontAttributeName - atIndex:0 - effectiveRange:nil]; + NSDictionary *attributes = [textStorage attributesAtIndex:range.location + effectiveRange:nil]; + UIFont *font = attributes[NSFontAttributeName]; + CGFloat baselineOffset = [attributes[NSBaselineOffsetAttributeName] doubleValue]; frame = { .origin = {glyphRect.origin.x, - glyphRect.origin.y + glyphRect.size.height - attachmentSize.height + font.descender}, + glyphRect.origin.y + glyphRect.size.height - attachmentSize.height + font.descender - + baselineOffset}, .size = attachmentSize}; auto rect = facebook::react::Rect{