diff --git a/packages/react-native/Libraries/Modal/Modal.js b/packages/react-native/Libraries/Modal/Modal.js index 5f3c943e9776..e011fc20763e 100644 --- a/packages/react-native/Libraries/Modal/Modal.js +++ b/packages/react-native/Libraries/Modal/Modal.js @@ -13,10 +13,7 @@ import type {ViewProps} from '../Components/View/ViewPropTypes'; import type {RootTag} from '../ReactNative/RootTag'; import type {DirectEventHandler} from '../Types/CodegenTypes'; -import NativeEventEmitter from '../EventEmitter/NativeEventEmitter'; import {type ColorValue} from '../StyleSheet/StyleSheet'; -import {type EventSubscription} from '../vendor/emitter/EventEmitter'; -import NativeModalManager from './NativeModalManager'; import RCTModalHostView from './RCTModalHostViewNativeComponent'; import VirtualizedLists from '@react-native/virtualized-lists'; import * as React from 'react'; @@ -32,21 +29,8 @@ const Platform = require('../Utilities/Platform').default; const VirtualizedListContextResetter = VirtualizedLists.VirtualizedListContextResetter; -type ModalEventDefinitions = { - modalDismissed: [{modalID: number}], -}; - export type ModalInstance = HostInstance; -const ModalEventEmitter = - Platform.OS === 'ios' && NativeModalManager != null - ? new NativeEventEmitter( - // T88715063: NativeEventEmitter only used this parameter on iOS. Now it uses it on all platforms, so this code was modified automatically to preserve its behavior - // If you want to use the native module on other platforms, please remove this condition and test its behavior - Platform.OS !== 'ios' ? null : NativeModalManager, - ) - : null; - // In order to route onDismiss callbacks, we need to uniquely identifier each // on screen. There can be different ones, either nested or as siblings. // We cannot pass the onDismiss callback to native as the view will be @@ -257,7 +241,6 @@ class Modal extends React.Component { static contextType: React.Context = RootTagContext; _identifier: number; - _eventSubscription: ?EventSubscription; constructor(props: ModalProps) { super(props); @@ -270,29 +253,10 @@ class Modal extends React.Component { }; } - componentDidMount() { - // 'modalDismissed' is for the old renderer in iOS only - if (ModalEventEmitter) { - this._eventSubscription = ModalEventEmitter.addListener( - 'modalDismissed', - event => { - this.setState({isRendered: false}, () => { - if (event.modalID === this._identifier && this.props.onDismiss) { - this.props.onDismiss(); - } - }); - }, - ); - } - } - componentWillUnmount() { if (Platform.OS === 'ios') { this.setState({isRendered: false}); } - if (this._eventSubscription) { - this._eventSubscription.remove(); - } } componentDidUpdate(prevProps: ModalProps) { diff --git a/packages/react-native/Libraries/Modal/NativeModalManager.js b/packages/react-native/Libraries/Modal/NativeModalManager.js deleted file mode 100644 index 0d6b730aaaac..000000000000 --- a/packages/react-native/Libraries/Modal/NativeModalManager.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ - -export * from '../../src/private/specs_DEPRECATED/modules/NativeModalManager'; -import NativeModalManager from '../../src/private/specs_DEPRECATED/modules/NativeModalManager'; - -export default NativeModalManager; diff --git a/packages/react-native/React/Base/RCTBridge.mm b/packages/react-native/React/Base/RCTBridge.mm index b75b728b8648..d7379488d371 100644 --- a/packages/react-native/React/Base/RCTBridge.mm +++ b/packages/react-native/React/Base/RCTBridge.mm @@ -54,7 +54,6 @@ @"RCTActivityIndicatorViewManager", @"RCTDebuggingOverlayManager", @"RCTModalHostViewManager", - @"RCTModalManager", @"RCTRefreshControlManager", @"RCTSafeAreaViewManager", @"RCTScrollContentViewManager", diff --git a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeModalManager.js b/packages/react-native/src/private/specs_DEPRECATED/modules/NativeModalManager.js deleted file mode 100644 index b25723b1b2bc..000000000000 --- a/packages/react-native/src/private/specs_DEPRECATED/modules/NativeModalManager.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow strict - * @format - */ - -import type {TurboModule} from '../../../../Libraries/TurboModule/RCTExport'; - -import * as TurboModuleRegistry from '../../../../Libraries/TurboModule/TurboModuleRegistry'; - -export interface Spec extends TurboModule { - // RCTEventEmitter - readonly addListener: (eventName: string) => void; - readonly removeListeners: (count: number) => void; -} - -export default TurboModuleRegistry.get('ModalManager') as ?Spec; diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api index dff12a0398b3..0117e5431e4e 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api @@ -3749,10 +3749,6 @@ class facebook::react::NativeMicrotasks : public facebook::react::NativeMicrotas public void queueMicrotask(facebook::jsi::Runtime& runtime, facebook::jsi::Function callback); } -class facebook::react::NativeModalManagerSpecJSI : public facebook::react::JavaTurboModule { - public NativeModalManagerSpecJSI(const facebook::react::JavaTurboModule::InitParams& params); -} - class facebook::react::NativeModule { public virtual facebook::react::MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic&& args) = 0; public virtual folly::dynamic getConstants() = 0; @@ -8960,12 +8956,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo public static constexpr std::string_view kModuleName; } -template -class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule { - protected NativeModalManagerCxxSpec(std::shared_ptr jsInvoker); - public static constexpr std::string_view kModuleName; -} - template class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule { protected NativeMutationObserverCxxSpec(std::shared_ptr jsInvoker); diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api index bae821b61ec2..c4c66888fa7a 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api @@ -3633,10 +3633,6 @@ class facebook::react::NativeMicrotasks : public facebook::react::NativeMicrotas public void queueMicrotask(facebook::jsi::Runtime& runtime, facebook::jsi::Function callback); } -class facebook::react::NativeModalManagerSpecJSI : public facebook::react::JavaTurboModule { - public NativeModalManagerSpecJSI(const facebook::react::JavaTurboModule::InitParams& params); -} - class facebook::react::NativeModulePerfLogger { public virtual void asyncMethodCallArgConversionEnd(const char* moduleName, const char* methodName) = 0; public virtual void asyncMethodCallArgConversionStart(const char* moduleName, const char* methodName) = 0; @@ -8721,12 +8717,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo public static constexpr std::string_view kModuleName; } -template -class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule { - protected NativeModalManagerCxxSpec(std::shared_ptr jsInvoker); - public static constexpr std::string_view kModuleName; -} - template class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule { protected NativeMutationObserverCxxSpec(std::shared_ptr jsInvoker); diff --git a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api index beb96517ca4e..330d3e2de968 100644 --- a/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api @@ -3746,10 +3746,6 @@ class facebook::react::NativeMicrotasks : public facebook::react::NativeMicrotas public void queueMicrotask(facebook::jsi::Runtime& runtime, facebook::jsi::Function callback); } -class facebook::react::NativeModalManagerSpecJSI : public facebook::react::JavaTurboModule { - public NativeModalManagerSpecJSI(const facebook::react::JavaTurboModule::InitParams& params); -} - class facebook::react::NativeModule { public virtual facebook::react::MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic&& args) = 0; public virtual folly::dynamic getConstants() = 0; @@ -8951,12 +8947,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo public static constexpr std::string_view kModuleName; } -template -class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule { - protected NativeModalManagerCxxSpec(std::shared_ptr jsInvoker); - public static constexpr std::string_view kModuleName; -} - template class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule { protected NativeMutationObserverCxxSpec(std::shared_ptr jsInvoker); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api index c27595d7f77a..9d5a5dc3babe 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api @@ -490,11 +490,6 @@ interface NativeLogBoxSpecBase : public NSObject { public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper); } -interface NativeModalManagerSpecBase : public NSObject { - protected facebook::react::EventEmitterCallback _eventEmitterCallback; - public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper); -} - interface NativeNetworkingIOSSpecBase : public NSObject { protected facebook::react::EventEmitterCallback _eventEmitterCallback; public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper); @@ -2449,11 +2444,6 @@ protocol NativeLogBoxSpec : public NSObjectRCTBridgeModule, public RCTTurboModul public virtual void show(); } -protocol NativeModalManagerSpec : public NSObjectRCTBridgeModule, public RCTTurboModule { - public virtual void addListener:(NSString* eventName); - public virtual void removeListeners:(double count); -} - protocol NativeNetworkingIOSSpec : public NSObjectRCTBridgeModule, public RCTTurboModule { public virtual void abortRequest:(double requestId); public virtual void addListener:(NSString* eventName); @@ -5936,10 +5926,6 @@ class facebook::react::NativeMicrotasks : public facebook::react::NativeMicrotas public void queueMicrotask(facebook::jsi::Runtime& runtime, facebook::jsi::Function callback); } -class facebook::react::NativeModalManagerSpecJSI : public facebook::react::ObjCTurboModule { - public NativeModalManagerSpecJSI(const facebook::react::ObjCTurboModule::InitParams& params); -} - class facebook::react::NativeModule { public virtual facebook::react::MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic&& args) = 0; public virtual folly::dynamic getConstants() = 0; @@ -10905,12 +10891,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo public static constexpr std::string_view kModuleName; } -template -class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule { - protected NativeModalManagerCxxSpec(std::shared_ptr jsInvoker); - public static constexpr std::string_view kModuleName; -} - template class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule { protected NativeMutationObserverCxxSpec(std::shared_ptr jsInvoker); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api index c8a738e9069d..c1d41df4d1c6 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api @@ -490,11 +490,6 @@ interface NativeLogBoxSpecBase : public NSObject { public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper); } -interface NativeModalManagerSpecBase : public NSObject { - protected facebook::react::EventEmitterCallback _eventEmitterCallback; - public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper); -} - interface NativeNetworkingIOSSpecBase : public NSObject { protected facebook::react::EventEmitterCallback _eventEmitterCallback; public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper); @@ -2438,11 +2433,6 @@ protocol NativeLogBoxSpec : public NSObjectRCTBridgeModule, public RCTTurboModul public virtual void show(); } -protocol NativeModalManagerSpec : public NSObjectRCTBridgeModule, public RCTTurboModule { - public virtual void addListener:(NSString* eventName); - public virtual void removeListeners:(double count); -} - protocol NativeNetworkingIOSSpec : public NSObjectRCTBridgeModule, public RCTTurboModule { public virtual void abortRequest:(double requestId); public virtual void addListener:(NSString* eventName); @@ -5848,10 +5838,6 @@ class facebook::react::NativeMicrotasks : public facebook::react::NativeMicrotas public void queueMicrotask(facebook::jsi::Runtime& runtime, facebook::jsi::Function callback); } -class facebook::react::NativeModalManagerSpecJSI : public facebook::react::ObjCTurboModule { - public NativeModalManagerSpecJSI(const facebook::react::ObjCTurboModule::InitParams& params); -} - class facebook::react::NativeModulePerfLogger { public virtual void asyncMethodCallArgConversionEnd(const char* moduleName, const char* methodName) = 0; public virtual void asyncMethodCallArgConversionStart(const char* moduleName, const char* methodName) = 0; @@ -10718,12 +10704,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo public static constexpr std::string_view kModuleName; } -template -class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule { - protected NativeModalManagerCxxSpec(std::shared_ptr jsInvoker); - public static constexpr std::string_view kModuleName; -} - template class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule { protected NativeMutationObserverCxxSpec(std::shared_ptr jsInvoker); diff --git a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api index 3d09b6d29173..a04b0303a281 100644 --- a/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api +++ b/scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api @@ -490,11 +490,6 @@ interface NativeLogBoxSpecBase : public NSObject { public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper); } -interface NativeModalManagerSpecBase : public NSObject { - protected facebook::react::EventEmitterCallback _eventEmitterCallback; - public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper); -} - interface NativeNetworkingIOSSpecBase : public NSObject { protected facebook::react::EventEmitterCallback _eventEmitterCallback; public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper); @@ -2449,11 +2444,6 @@ protocol NativeLogBoxSpec : public NSObjectRCTBridgeModule, public RCTTurboModul public virtual void show(); } -protocol NativeModalManagerSpec : public NSObjectRCTBridgeModule, public RCTTurboModule { - public virtual void addListener:(NSString* eventName); - public virtual void removeListeners:(double count); -} - protocol NativeNetworkingIOSSpec : public NSObjectRCTBridgeModule, public RCTTurboModule { public virtual void abortRequest:(double requestId); public virtual void addListener:(NSString* eventName); @@ -5933,10 +5923,6 @@ class facebook::react::NativeMicrotasks : public facebook::react::NativeMicrotas public void queueMicrotask(facebook::jsi::Runtime& runtime, facebook::jsi::Function callback); } -class facebook::react::NativeModalManagerSpecJSI : public facebook::react::ObjCTurboModule { - public NativeModalManagerSpecJSI(const facebook::react::ObjCTurboModule::InitParams& params); -} - class facebook::react::NativeModule { public virtual facebook::react::MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic&& args) = 0; public virtual folly::dynamic getConstants() = 0; @@ -10896,12 +10882,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo public static constexpr std::string_view kModuleName; } -template -class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule { - protected NativeModalManagerCxxSpec(std::shared_ptr jsInvoker); - public static constexpr std::string_view kModuleName; -} - template class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule { protected NativeMutationObserverCxxSpec(std::shared_ptr jsInvoker);