[ReactNative] Fix React Devtools integration

This commit is contained in:
Alex Kotliarskyi 2015-03-23 13:22:37 -07:00
parent 62766e6077
commit 0cdf56cc4f
1 changed files with 15 additions and 9 deletions

View File

@ -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;