diff --git a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm b/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm index 1029a87ad4a..9bd39d06624 100644 --- a/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm +++ b/ReactCommon/fabric/textlayoutmanager/platform/ios/RCTTextLayoutManager.mm @@ -10,12 +10,13 @@ #import "NSTextStorage+FontScaling.h" #import "RCTAttributedTextUtils.h" +#import #import using namespace facebook::react; @implementation RCTTextLayoutManager { - SimpleThreadSafeCache, 256> _cache; + SimpleThreadSafeCache, 256> _cache; } static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsizeMode) @@ -171,12 +172,11 @@ static NSLineBreakMode RCTNSLineBreakModeFromEllipsizeMode(EllipsizeMode ellipsi - (NSAttributedString *)_nsAttributedStringFromAttributedString:(AttributedString)attributedString { - auto sharedNSAttributedString = _cache.get(attributedString, [](const AttributedString attributedString) { - return std::shared_ptr( - (__bridge_retained void *)RCTNSAttributedStringFromAttributedString(attributedString), CFRelease); + auto sharedNSAttributedString = _cache.get(attributedString, [](AttributedString attributedString) { + return wrapManagedObject(RCTNSAttributedStringFromAttributedString(attributedString)); }); - return (__bridge NSAttributedString *)sharedNSAttributedString.get(); + return unwrapManagedObject(sharedNSAttributedString); } @end