Skip to content

Commit b891ad8

Browse files
Remove unused NativeModalManager spec and all related code
Summary: Changelog: [INTERNAL] Remove the dead `NativeModalManager` TurboModule spec and all its dependents — 13 files, 192 deletions across JS spec, Modal.js usage, native registration, CXX API snapshots, blocklist entries, and test mocks. The spec was never implemented and the Modal component no longer needs the event subscription pattern since transitioning to the new renderer. Differential Revision: D114652881
1 parent 3a95e0e commit b891ad8

10 files changed

Lines changed: 0 additions & 162 deletions

File tree

packages/react-native/Libraries/Modal/Modal.js

Lines changed: 0 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ import type {ViewProps} from '../Components/View/ViewPropTypes';
1313
import type {RootTag} from '../ReactNative/RootTag';
1414
import type {DirectEventHandler} from '../Types/CodegenTypes';
1515

16-
import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
1716
import {type ColorValue} from '../StyleSheet/StyleSheet';
18-
import {type EventSubscription} from '../vendor/emitter/EventEmitter';
19-
import NativeModalManager from './NativeModalManager';
2017
import RCTModalHostView from './RCTModalHostViewNativeComponent';
2118
import VirtualizedLists from '@react-native/virtualized-lists';
2219
import * as React from 'react';
@@ -32,21 +29,8 @@ const Platform = require('../Utilities/Platform').default;
3229
const VirtualizedListContextResetter =
3330
VirtualizedLists.VirtualizedListContextResetter;
3431

35-
type ModalEventDefinitions = {
36-
modalDismissed: [{modalID: number}],
37-
};
38-
3932
export type ModalInstance = HostInstance;
4033

41-
const ModalEventEmitter =
42-
Platform.OS === 'ios' && NativeModalManager != null
43-
? new NativeEventEmitter<ModalEventDefinitions>(
44-
// 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
45-
// If you want to use the native module on other platforms, please remove this condition and test its behavior
46-
Platform.OS !== 'ios' ? null : NativeModalManager,
47-
)
48-
: null;
49-
5034
// In order to route onDismiss callbacks, we need to uniquely identifier each
5135
// <Modal> on screen. There can be different ones, either nested or as siblings.
5236
// We cannot pass the onDismiss callback to native as the view will be
@@ -257,7 +241,6 @@ class Modal extends React.Component<ModalProps, ModalState> {
257241
static contextType: React.Context<RootTag> = RootTagContext;
258242

259243
_identifier: number;
260-
_eventSubscription: ?EventSubscription;
261244

262245
constructor(props: ModalProps) {
263246
super(props);
@@ -270,29 +253,10 @@ class Modal extends React.Component<ModalProps, ModalState> {
270253
};
271254
}
272255

273-
componentDidMount() {
274-
// 'modalDismissed' is for the old renderer in iOS only
275-
if (ModalEventEmitter) {
276-
this._eventSubscription = ModalEventEmitter.addListener(
277-
'modalDismissed',
278-
event => {
279-
this.setState({isRendered: false}, () => {
280-
if (event.modalID === this._identifier && this.props.onDismiss) {
281-
this.props.onDismiss();
282-
}
283-
});
284-
},
285-
);
286-
}
287-
}
288-
289256
componentWillUnmount() {
290257
if (Platform.OS === 'ios') {
291258
this.setState({isRendered: false});
292259
}
293-
if (this._eventSubscription) {
294-
this._eventSubscription.remove();
295-
}
296260
}
297261

298262
componentDidUpdate(prevProps: ModalProps) {

packages/react-native/Libraries/Modal/NativeModalManager.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

packages/react-native/React/Base/RCTBridge.mm

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
@"RCTActivityIndicatorViewManager",
5555
@"RCTDebuggingOverlayManager",
5656
@"RCTModalHostViewManager",
57-
@"RCTModalManager",
5857
@"RCTRefreshControlManager",
5958
@"RCTSafeAreaViewManager",
6059
@"RCTScrollContentViewManager",

packages/react-native/src/private/specs_DEPRECATED/modules/NativeModalManager.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3749,10 +3749,6 @@ class facebook::react::NativeMicrotasks : public facebook::react::NativeMicrotas
37493749
public void queueMicrotask(facebook::jsi::Runtime& runtime, facebook::jsi::Function callback);
37503750
}
37513751

3752-
class facebook::react::NativeModalManagerSpecJSI : public facebook::react::JavaTurboModule {
3753-
public NativeModalManagerSpecJSI(const facebook::react::JavaTurboModule::InitParams& params);
3754-
}
3755-
37563752
class facebook::react::NativeModule {
37573753
public virtual facebook::react::MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic&& args) = 0;
37583754
public virtual folly::dynamic getConstants() = 0;
@@ -8960,12 +8956,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo
89608956
public static constexpr std::string_view kModuleName;
89618957
}
89628958

8963-
template <typename T>
8964-
class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule {
8965-
protected NativeModalManagerCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
8966-
public static constexpr std::string_view kModuleName;
8967-
}
8968-
89698959
template <typename T>
89708960
class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule {
89718961
protected NativeMutationObserverCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);

scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3633,10 +3633,6 @@ class facebook::react::NativeMicrotasks : public facebook::react::NativeMicrotas
36333633
public void queueMicrotask(facebook::jsi::Runtime& runtime, facebook::jsi::Function callback);
36343634
}
36353635

3636-
class facebook::react::NativeModalManagerSpecJSI : public facebook::react::JavaTurboModule {
3637-
public NativeModalManagerSpecJSI(const facebook::react::JavaTurboModule::InitParams& params);
3638-
}
3639-
36403636
class facebook::react::NativeModulePerfLogger {
36413637
public virtual void asyncMethodCallArgConversionEnd(const char* moduleName, const char* methodName) = 0;
36423638
public virtual void asyncMethodCallArgConversionStart(const char* moduleName, const char* methodName) = 0;
@@ -8721,12 +8717,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo
87218717
public static constexpr std::string_view kModuleName;
87228718
}
87238719

8724-
template <typename T>
8725-
class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule {
8726-
protected NativeModalManagerCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
8727-
public static constexpr std::string_view kModuleName;
8728-
}
8729-
87308720
template <typename T>
87318721
class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule {
87328722
protected NativeMutationObserverCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);

scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3746,10 +3746,6 @@ class facebook::react::NativeMicrotasks : public facebook::react::NativeMicrotas
37463746
public void queueMicrotask(facebook::jsi::Runtime& runtime, facebook::jsi::Function callback);
37473747
}
37483748

3749-
class facebook::react::NativeModalManagerSpecJSI : public facebook::react::JavaTurboModule {
3750-
public NativeModalManagerSpecJSI(const facebook::react::JavaTurboModule::InitParams& params);
3751-
}
3752-
37533749
class facebook::react::NativeModule {
37543750
public virtual facebook::react::MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic&& args) = 0;
37553751
public virtual folly::dynamic getConstants() = 0;
@@ -8951,12 +8947,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo
89518947
public static constexpr std::string_view kModuleName;
89528948
}
89538949

8954-
template <typename T>
8955-
class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule {
8956-
protected NativeModalManagerCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
8957-
public static constexpr std::string_view kModuleName;
8958-
}
8959-
89608950
template <typename T>
89618951
class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule {
89628952
protected NativeMutationObserverCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);

scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,6 @@ interface NativeLogBoxSpecBase : public NSObject {
490490
public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper);
491491
}
492492

493-
interface NativeModalManagerSpecBase : public NSObject {
494-
protected facebook::react::EventEmitterCallback _eventEmitterCallback;
495-
public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper);
496-
}
497-
498493
interface NativeNetworkingIOSSpecBase : public NSObject {
499494
protected facebook::react::EventEmitterCallback _eventEmitterCallback;
500495
public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper);
@@ -2449,11 +2444,6 @@ protocol NativeLogBoxSpec : public NSObjectRCTBridgeModule, public RCTTurboModul
24492444
public virtual void show();
24502445
}
24512446

2452-
protocol NativeModalManagerSpec : public NSObjectRCTBridgeModule, public RCTTurboModule {
2453-
public virtual void addListener:(NSString* eventName);
2454-
public virtual void removeListeners:(double count);
2455-
}
2456-
24572447
protocol NativeNetworkingIOSSpec : public NSObjectRCTBridgeModule, public RCTTurboModule {
24582448
public virtual void abortRequest:(double requestId);
24592449
public virtual void addListener:(NSString* eventName);
@@ -5936,10 +5926,6 @@ class facebook::react::NativeMicrotasks : public facebook::react::NativeMicrotas
59365926
public void queueMicrotask(facebook::jsi::Runtime& runtime, facebook::jsi::Function callback);
59375927
}
59385928

5939-
class facebook::react::NativeModalManagerSpecJSI : public facebook::react::ObjCTurboModule {
5940-
public NativeModalManagerSpecJSI(const facebook::react::ObjCTurboModule::InitParams& params);
5941-
}
5942-
59435929
class facebook::react::NativeModule {
59445930
public virtual facebook::react::MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic&& args) = 0;
59455931
public virtual folly::dynamic getConstants() = 0;
@@ -10905,12 +10891,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo
1090510891
public static constexpr std::string_view kModuleName;
1090610892
}
1090710893

10908-
template <typename T>
10909-
class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule {
10910-
protected NativeModalManagerCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
10911-
public static constexpr std::string_view kModuleName;
10912-
}
10913-
1091410894
template <typename T>
1091510895
class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule {
1091610896
protected NativeMutationObserverCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);

scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,6 @@ interface NativeLogBoxSpecBase : public NSObject {
490490
public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper);
491491
}
492492

493-
interface NativeModalManagerSpecBase : public NSObject {
494-
protected facebook::react::EventEmitterCallback _eventEmitterCallback;
495-
public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper);
496-
}
497-
498493
interface NativeNetworkingIOSSpecBase : public NSObject {
499494
protected facebook::react::EventEmitterCallback _eventEmitterCallback;
500495
public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper);
@@ -2438,11 +2433,6 @@ protocol NativeLogBoxSpec : public NSObjectRCTBridgeModule, public RCTTurboModul
24382433
public virtual void show();
24392434
}
24402435

2441-
protocol NativeModalManagerSpec : public NSObjectRCTBridgeModule, public RCTTurboModule {
2442-
public virtual void addListener:(NSString* eventName);
2443-
public virtual void removeListeners:(double count);
2444-
}
2445-
24462436
protocol NativeNetworkingIOSSpec : public NSObjectRCTBridgeModule, public RCTTurboModule {
24472437
public virtual void abortRequest:(double requestId);
24482438
public virtual void addListener:(NSString* eventName);
@@ -5848,10 +5838,6 @@ class facebook::react::NativeMicrotasks : public facebook::react::NativeMicrotas
58485838
public void queueMicrotask(facebook::jsi::Runtime& runtime, facebook::jsi::Function callback);
58495839
}
58505840

5851-
class facebook::react::NativeModalManagerSpecJSI : public facebook::react::ObjCTurboModule {
5852-
public NativeModalManagerSpecJSI(const facebook::react::ObjCTurboModule::InitParams& params);
5853-
}
5854-
58555841
class facebook::react::NativeModulePerfLogger {
58565842
public virtual void asyncMethodCallArgConversionEnd(const char* moduleName, const char* methodName) = 0;
58575843
public virtual void asyncMethodCallArgConversionStart(const char* moduleName, const char* methodName) = 0;
@@ -10718,12 +10704,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo
1071810704
public static constexpr std::string_view kModuleName;
1071910705
}
1072010706

10721-
template <typename T>
10722-
class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule {
10723-
protected NativeModalManagerCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
10724-
public static constexpr std::string_view kModuleName;
10725-
}
10726-
1072710707
template <typename T>
1072810708
class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule {
1072910709
protected NativeMutationObserverCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);

scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -490,11 +490,6 @@ interface NativeLogBoxSpecBase : public NSObject {
490490
public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper);
491491
}
492492

493-
interface NativeModalManagerSpecBase : public NSObject {
494-
protected facebook::react::EventEmitterCallback _eventEmitterCallback;
495-
public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper);
496-
}
497-
498493
interface NativeNetworkingIOSSpecBase : public NSObject {
499494
protected facebook::react::EventEmitterCallback _eventEmitterCallback;
500495
public virtual void setEventEmitterCallback:(EventEmitterCallbackWrapper* eventEmitterCallbackWrapper);
@@ -2449,11 +2444,6 @@ protocol NativeLogBoxSpec : public NSObjectRCTBridgeModule, public RCTTurboModul
24492444
public virtual void show();
24502445
}
24512446

2452-
protocol NativeModalManagerSpec : public NSObjectRCTBridgeModule, public RCTTurboModule {
2453-
public virtual void addListener:(NSString* eventName);
2454-
public virtual void removeListeners:(double count);
2455-
}
2456-
24572447
protocol NativeNetworkingIOSSpec : public NSObjectRCTBridgeModule, public RCTTurboModule {
24582448
public virtual void abortRequest:(double requestId);
24592449
public virtual void addListener:(NSString* eventName);
@@ -5933,10 +5923,6 @@ class facebook::react::NativeMicrotasks : public facebook::react::NativeMicrotas
59335923
public void queueMicrotask(facebook::jsi::Runtime& runtime, facebook::jsi::Function callback);
59345924
}
59355925

5936-
class facebook::react::NativeModalManagerSpecJSI : public facebook::react::ObjCTurboModule {
5937-
public NativeModalManagerSpecJSI(const facebook::react::ObjCTurboModule::InitParams& params);
5938-
}
5939-
59405926
class facebook::react::NativeModule {
59415927
public virtual facebook::react::MethodCallResult callSerializableNativeHook(unsigned int reactMethodId, folly::dynamic&& args) = 0;
59425928
public virtual folly::dynamic getConstants() = 0;
@@ -10896,12 +10882,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo
1089610882
public static constexpr std::string_view kModuleName;
1089710883
}
1089810884

10899-
template <typename T>
10900-
class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule {
10901-
protected NativeModalManagerCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
10902-
public static constexpr std::string_view kModuleName;
10903-
}
10904-
1090510885
template <typename T>
1090610886
class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule {
1090710887
protected NativeMutationObserverCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);

0 commit comments

Comments
 (0)