Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 0 additions & 36 deletions packages/react-native/Libraries/Modal/Modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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<ModalEventDefinitions>(
// 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
// <Modal> 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
Expand Down Expand Up @@ -257,7 +241,6 @@ class Modal extends React.Component<ModalProps, ModalState> {
static contextType: React.Context<RootTag> = RootTagContext;

_identifier: number;
_eventSubscription: ?EventSubscription;

constructor(props: ModalProps) {
super(props);
Expand All @@ -270,29 +253,10 @@ class Modal extends React.Component<ModalProps, ModalState> {
};
}

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) {
Expand Down
14 changes: 0 additions & 14 deletions packages/react-native/Libraries/Modal/NativeModalManager.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/react-native/React/Base/RCTBridge.mm
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
@"RCTActivityIndicatorViewManager",
@"RCTDebuggingOverlayManager",
@"RCTModalHostViewManager",
@"RCTModalManager",
@"RCTRefreshControlManager",
@"RCTSafeAreaViewManager",
@"RCTScrollContentViewManager",
Expand Down

This file was deleted.

10 changes: 0 additions & 10 deletions scripts/cxx-api/api-snapshots/ReactAndroidDebugCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -8960,12 +8956,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo
public static constexpr std::string_view kModuleName;
}

template <typename T>
class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule {
protected NativeModalManagerCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
public static constexpr std::string_view kModuleName;
}

template <typename T>
class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule {
protected NativeMutationObserverCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
Expand Down
10 changes: 0 additions & 10 deletions scripts/cxx-api/api-snapshots/ReactAndroidNewarchCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -8721,12 +8717,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo
public static constexpr std::string_view kModuleName;
}

template <typename T>
class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule {
protected NativeModalManagerCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
public static constexpr std::string_view kModuleName;
}

template <typename T>
class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule {
protected NativeMutationObserverCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
Expand Down
10 changes: 0 additions & 10 deletions scripts/cxx-api/api-snapshots/ReactAndroidReleaseCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -8951,12 +8947,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo
public static constexpr std::string_view kModuleName;
}

template <typename T>
class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule {
protected NativeModalManagerCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
public static constexpr std::string_view kModuleName;
}

template <typename T>
class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule {
protected NativeMutationObserverCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
Expand Down
20 changes: 0 additions & 20 deletions scripts/cxx-api/api-snapshots/ReactAppleDebugCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -10905,12 +10891,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo
public static constexpr std::string_view kModuleName;
}

template <typename T>
class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule {
protected NativeModalManagerCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
public static constexpr std::string_view kModuleName;
}

template <typename T>
class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule {
protected NativeMutationObserverCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
Expand Down
20 changes: 0 additions & 20 deletions scripts/cxx-api/api-snapshots/ReactAppleNewarchCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -10718,12 +10704,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo
public static constexpr std::string_view kModuleName;
}

template <typename T>
class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule {
protected NativeModalManagerCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
public static constexpr std::string_view kModuleName;
}

template <typename T>
class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule {
protected NativeMutationObserverCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
Expand Down
20 changes: 0 additions & 20 deletions scripts/cxx-api/api-snapshots/ReactAppleReleaseCxx.api
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -10896,12 +10882,6 @@ class facebook::react::NativeMicrotasksCxxSpec : public facebook::react::TurboMo
public static constexpr std::string_view kModuleName;
}

template <typename T>
class facebook::react::NativeModalManagerCxxSpec : public facebook::react::TurboModule {
protected NativeModalManagerCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
public static constexpr std::string_view kModuleName;
}

template <typename T>
class facebook::react::NativeMutationObserverCxxSpec : public facebook::react::TurboModule {
protected NativeMutationObserverCxxSpec(std::shared_ptr<facebook::react::CallInvoker> jsInvoker);
Expand Down