From bd70f3ab3b2807ce3648548d3e70577d09c4e3c2 Mon Sep 17 00:00:00 2001 From: Lee Byron Date: Mon, 25 Sep 2017 19:23:42 -0700 Subject: [PATCH] Remove older devtools hook Summary: As of v1.4.0, a new devtools hook is used that is hosted within `relay-devtools` instead of `relay-runtime`. That allows debugging of production relay apps, and reduces byte size of Relay. As a result, relay-debugger-react-native-runtime and RelayDebugger can be removed. Reviewed By: kassens Differential Revision: D5904296 fbshipit-source-id: 2b215f5a25ecb2922b00cdf86f7d31415d8d1328 --- Libraries/Core/Devtools/setupDevtools.js | 45 +++++++++++------------- 1 file changed, 20 insertions(+), 25 deletions(-) diff --git a/Libraries/Core/Devtools/setupDevtools.js b/Libraries/Core/Devtools/setupDevtools.js index 05968d53a..869eb7ccd 100644 --- a/Libraries/Core/Devtools/setupDevtools.js +++ b/Libraries/Core/Devtools/setupDevtools.js @@ -34,33 +34,28 @@ if (__DEV__) { * comment and run Flow. */ const reactDevTools = require('react-devtools-core'); - register = function (plugin: DevToolsPlugin) { - // Initialize dev tools only if the native module for WebSocket is available - if (WebSocket.isAvailable) { - // Don't steal the DevTools from currently active app. - // Note: if you add any AppState subscriptions to this file, - // you will also need to guard against `AppState.isAvailable`, - // or the code will throw for bundles that don't have it. - const isAppActive = () => AppState.currentState !== 'background'; + // Initialize dev tools only if the native module for WebSocket is available + if (WebSocket.isAvailable) { + // Don't steal the DevTools from currently active app. + // Note: if you add any AppState subscriptions to this file, + // you will also need to guard against `AppState.isAvailable`, + // or the code will throw for bundles that don't have it. + const isAppActive = () => AppState.currentState !== 'background'; - // Special case: Genymotion is running on a different host. - const host = PlatformConstants && PlatformConstants.ServerHost ? - PlatformConstants.ServerHost.split(':')[0] : - 'localhost'; + // Special case: Genymotion is running on a different host. + const host = PlatformConstants && PlatformConstants.ServerHost ? + PlatformConstants.ServerHost.split(':')[0] : + 'localhost'; - plugin.connectToDevTools({ - isAppActive, - host, - // Read the optional global variable for backward compatibility. - // It was added in https://github.com/facebook/react-native/commit/bf2b435322e89d0aeee8792b1c6e04656c2719a0. - port: window.__REACT_DEVTOOLS_PORT__, - resolveRNStyle: require('flattenStyle'), - }); - } - }; - - register(reactDevTools); - global.registerDevtoolsPlugin = register; + reactDevTools.connectToDevTools({ + isAppActive, + host, + // Read the optional global variable for backward compatibility. + // It was added in https://github.com/facebook/react-native/commit/bf2b435322e89d0aeee8792b1c6e04656c2719a0. + port: window.__REACT_DEVTOOLS_PORT__, + resolveRNStyle: require('flattenStyle'), + }); + } } module.exports = {