Skip to content

Commit

Permalink
upgrade React Native on a new RDT backend
Browse files Browse the repository at this point in the history
Summary:
# Changelog: [Internal]

In React DevTools 6.0.0, settings manager is [no longer used](facebook/react#30986), because the host of the Backend is responsible for settings persistance.

Also, `installHook()` call was removed from the top level of the JavaScript module and now we need to call `initialize()` explicitly.

The logic for persisting settings will be added in one of the next diffs at the top.

Differential Revision: D62967059
  • Loading branch information
hoxyq authored and facebook-github-bot committed Sep 26, 2024
1 parent fed252c commit e8736b4
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/react-native/Libraries/Core/setUpReactDevTools.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@ import type {Domain} from '../../src/private/fusebox/setUpFuseboxReactDevToolsDi
if (__DEV__) {
// Register dispatcher on global, which can be used later by Chrome DevTools frontend
require('../../src/private/fusebox/setUpFuseboxReactDevToolsDispatcher');
const {
initialize,
connectToDevTools,
connectWithCustomMessagingProtocol,
} = require('react-devtools-core');

// Install hook before React is loaded.
const reactDevTools = require('react-devtools-core');
initialize();

// This should be defined in DEV, otherwise error is expected.
const fuseboxReactDevToolsDispatcher =
global.__FUSEBOX_REACT_DEVTOOLS_DISPATCHER__;
const reactDevToolsFuseboxGlobalBindingName =
fuseboxReactDevToolsDispatcher.BINDING_NAME;

const ReactNativeStyleAttributes = require('../Components/View/ReactNativeStyleAttributes');
const devToolsSettingsManager = require('../DevToolsSettings/DevToolsSettingsManager');
const resolveRNStyle = require('../StyleSheet/flattenStyle');

let disconnect = null;
Expand All @@ -37,7 +42,7 @@ if (__DEV__) {
}

function connectToReactDevToolsInFusebox(domain: Domain) {
disconnect = reactDevTools.connectWithCustomMessagingProtocol({
disconnect = connectWithCustomMessagingProtocol({
onSubscribe: listener => {
domain.onMessage.addEventListener(listener);
},
Expand All @@ -47,7 +52,6 @@ if (__DEV__) {
onMessage: (event, payload) => {
domain.sendMessage({event, payload});
},
settingsManager: devToolsSettingsManager,
nativeStyleEditorValidAttributes: Object.keys(ReactNativeStyleAttributes),
resolveRNStyle,
});
Expand Down Expand Up @@ -101,14 +105,13 @@ if (__DEV__) {
isWebSocketOpen = true;
});

reactDevTools.connectToDevTools({
connectToDevTools({
isAppActive,
resolveRNStyle,
nativeStyleEditorValidAttributes: Object.keys(
ReactNativeStyleAttributes,
),
websocket: ws,
devToolsSettingsManager,
});
}
}
Expand Down

0 comments on commit e8736b4

Please sign in to comment.