From 0cdf56cc4f198679d58d66f42def5781d9eaa7f7 Mon Sep 17 00:00:00 2001 From: Alex Kotliarskyi Date: Mon, 23 Mar 2015 13:22:37 -0700 Subject: [PATCH] [ReactNative] Fix React Devtools integration --- Libraries/ReactIOS/ReactIOS.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Libraries/ReactIOS/ReactIOS.js b/Libraries/ReactIOS/ReactIOS.js index 2dfcb2604..a683c0a33 100644 --- a/Libraries/ReactIOS/ReactIOS.js +++ b/Libraries/ReactIOS/ReactIOS.js @@ -83,15 +83,6 @@ var ReactIOS = { _augmentElement: augmentElement, render: render, unmountComponentAtNode: ReactIOSMount.unmountComponentAtNode, - /** - * Used by the debugger. - */ - __internals: { - Component: ReactComponent, - CurrentOwner: ReactCurrentOwner, - InstanceHandles: ReactInstanceHandles, - Mount: ReactIOSMount, - }, // Hook for JSX spread, don't use this for anything else. __spread: Object.assign, @@ -117,4 +108,19 @@ var ReactIOS = { ) }; +// Inject the runtime into a devtools global hook regardless of browser. +// Allows for debugging when the hook is injected on the page. +/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__ */ +if ( + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && + typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { + __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ + CurrentOwner: ReactCurrentOwner, + InstanceHandles: ReactInstanceHandles, + Mount: ReactIOSMount, + Reconciler: require('ReactReconciler'), + TextComponent: require('ReactIOSTextComponent'), + }); +} + module.exports = ReactIOS;