From 9b06d0d8a9b75f84ec932f150e1fd3c76d246971 Mon Sep 17 00:00:00 2001 From: Jin Lee Date: Wed, 22 Jan 2025 11:52:34 -0800 Subject: [PATCH] Back out "Disable weak event emitter in AttributedString for Apple Silicon Mac running iOS build app" (#48868) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48868 Original commit changeset: ac48be3305eb Original Phabricator Diff: D68093083 Changelog: [iOS][Removed] - Removed workaround for a iOS build app running on Apple Silicon Mac(in Xcode Destination: "Mac(Designed for iPad)") TextInput crash due to serialization attempt of WeakEventEmitter Reviewed By: javache Differential Revision: D68452788 fbshipit-source-id: 9d3466950c43a10f36ca594997ae5a586d1a2a00 --- .../ComponentViews/TextInput/RCTTextInputComponentView.mm | 4 ++-- .../renderer/textlayoutmanager/RCTAttributedTextUtils.mm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm index 3bca1fc9fb3..faa494a615d 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm @@ -101,7 +101,7 @@ static NSSet *returnKeyTypesSet; NSMutableDictionary *defaultAttributes = [_backedTextInputView.defaultTextAttributes mutableCopy]; -#if !TARGET_OS_MAC && !TARGET_OS_MACCATALYST +#if !TARGET_OS_MACCATALYST RCTWeakEventEmitterWrapper *eventEmitterWrapper = [RCTWeakEventEmitterWrapper new]; eventEmitterWrapper.eventEmitter = _eventEmitter; defaultAttributes[RCTAttributedStringEventEmitterKey] = eventEmitterWrapper; @@ -266,7 +266,7 @@ static NSSet *returnKeyTypesSet; if (newTextInputProps.textAttributes != oldTextInputProps.textAttributes) { NSMutableDictionary *defaultAttributes = RCTNSTextAttributesFromTextAttributes(newTextInputProps.getEffectiveTextAttributes(RCTFontSizeMultiplier())); -#if !TARGET_OS_MAC && !TARGET_OS_MACCATALYST +#if !TARGET_OS_MACCATALYST defaultAttributes[RCTAttributedStringEventEmitterKey] = _backedTextInputView.defaultTextAttributes[RCTAttributedStringEventEmitterKey]; #endif 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 ec8465320e8..2a5185d344c 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 @@ -407,7 +407,7 @@ static NSMutableAttributedString *RCTNSAttributedStringFragmentWithAttributesFro { auto nsAttributedStringFragment = RCTNSAttributedStringFragmentFromFragment(fragment, placeholderImage); -#if !TARGET_OS_MAC && !TARGET_OS_MACCATALYST +#if !TARGET_OS_MACCATALYST if (fragment.parentShadowView.componentHandle) { RCTWeakEventEmitterWrapper *eventEmitterWrapper = [RCTWeakEventEmitterWrapper new]; eventEmitterWrapper.eventEmitter = fragment.parentShadowView.eventEmitter;