mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/51822 Adds `flow` to the remaining files without it, in React Native. After this, every `*.{flow,js}` file in React Native will have either `flow` or `noflow`. Changelog: [Internal] Reviewed By: NickGerleman Differential Revision: D75980238 fbshipit-source-id: 84cd88e4eb0b0b1dc69df247de79a75c2119bf96
46 lines
1.4 KiB
JavaScript
46 lines
1.4 KiB
JavaScript
/**
|
|
* 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-local
|
|
* @format
|
|
*/
|
|
|
|
// $FlowFixMe[prop-missing]
|
|
const {contextBridge, ipcRenderer} = require('electron');
|
|
|
|
contextBridge.executeInMainWorld({
|
|
func: ipcDevTools => {
|
|
let didDecorateInspectorFrontendHostInstance = false;
|
|
// reactNativeDecorateInspectorFrontendHostInstance was introduced in
|
|
// https://github.com/facebook/react-native-devtools-frontend/pull/168
|
|
// $FlowIgnore[prop-missing]
|
|
globalThis.reactNativeDecorateInspectorFrontendHostInstance = (
|
|
InspectorFrontendHostInstance: $FlowFixMe,
|
|
) => {
|
|
didDecorateInspectorFrontendHostInstance = true;
|
|
InspectorFrontendHostInstance.bringToFront = () => {
|
|
ipcDevTools.bringToFront();
|
|
};
|
|
};
|
|
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
if (!didDecorateInspectorFrontendHostInstance) {
|
|
console.error(
|
|
'reactNativeDecorateInspectorFrontendHostInstance was not called at startup. ' +
|
|
'This version of the DevTools frontend may not be compatible with @react-native/debugger-shell.',
|
|
);
|
|
}
|
|
});
|
|
},
|
|
args: [
|
|
{
|
|
bringToFront() {
|
|
ipcRenderer.send('bringToFront');
|
|
},
|
|
},
|
|
],
|
|
});
|