Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: defer ReactDevToolsOverlay import #43690

Closed
wants to merge 1 commit into from
Closed
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
23 changes: 21 additions & 2 deletions packages/react-native/Libraries/ReactNative/AppContainer-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import View from '../Components/View/View';
import DebuggingOverlay from '../Debugging/DebuggingOverlay';
import useSubscribeToDebuggingOverlayRegistry from '../Debugging/useSubscribeToDebuggingOverlayRegistry';
import RCTDeviceEventEmitter from '../EventEmitter/RCTDeviceEventEmitter';
import ReactDevToolsOverlay from '../Inspector/ReactDevToolsOverlay';
import LogBoxNotificationContainer from '../LogBox/LogBoxNotificationContainer';
import StyleSheet from '../StyleSheet/StyleSheet';
import {RootTagContext, createRootTag} from './RootTag';
Expand Down Expand Up @@ -64,6 +63,26 @@ const InspectorDeferred = ({
);
};

type ReactDevToolsOverlayDeferredProps = {
inspectedViewRef: InspectedViewRef,
reactDevToolsAgent: ReactDevToolsAgent,
};

const ReactDevToolsOverlayDeferred = ({
inspectedViewRef,
reactDevToolsAgent,
}: ReactDevToolsOverlayDeferredProps) => {
const ReactDevToolsOverlay =
require('../Inspector/ReactDevToolsOverlay').default;

return (
<ReactDevToolsOverlay
inspectedViewRef={inspectedViewRef}
reactDevToolsAgent={reactDevToolsAgent}
/>
);
};

const AppContainer = ({
children,
fabric,
Expand Down Expand Up @@ -155,7 +174,7 @@ const AppContainer = ({
<DebuggingOverlay ref={debuggingOverlayRef} />

{reactDevToolsAgent != null && (
<ReactDevToolsOverlay
<ReactDevToolsOverlayDeferred
inspectedViewRef={innerViewRef}
reactDevToolsAgent={reactDevToolsAgent}
/>
Expand Down
Loading