Update devtools injection
This isn't actually used right now so I can't test it. Because the Chrome devtools are broken for React Native. The Nuclide integration is in the react-native repo.
Sebastian Markbage committed
Apr 18, 2016 at 21:47 UTC
5470972f6a61111da661b0092d71645751bf1259
1 file changed
+17
-3
src/renderers/native/ReactNative/ReactNative.js
+17
-3
@@ -13,6 +13,7 @@
13
14
// Require ReactNativeDefaultInjection first for its side effects of setting up
15
// the JS environment
16
+var ReactNativeComponentTree = require('ReactNativeComponentTree');
17
var ReactNativeDefaultInjection = require('ReactNativeDefaultInjection');
18
19
var ReactCurrentOwner = require('ReactCurrentOwner');
@@ -63,11 +64,24 @@ if (
64
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' &&
65
typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') {
66
__REACT_DEVTOOLS_GLOBAL_HOOK__.inject({
66
- CurrentOwner: ReactCurrentOwner,
67
- InstanceHandles: ReactInstanceHandles,
67
+ ComponentTree: {
68
+ getClosestInstanceFromNode: function(node) {
69
+ return ReactNativeComponentTree.getClosestInstanceFromNode(node);
70
+ },
71
+ getNodeFromInstance: function(inst) {
72
+ // inst is an internal instance (but could be a composite)
73
+ while (inst._renderedComponent) {
74
+ inst = inst._renderedComponent;
75
+ }
76
+ if (inst) {
77
+ return ReactNativeComponentTree.getNodeFromInstance(inst);
78
+ } else {
79
+ return null;
80
+ }
81
+ },
82
+ },
83
Mount: ReactNativeMount,
84
Reconciler: require('ReactReconciler'),
70
- TextComponent: require('ReactNativeTextComponent'),
85
});
86
}
87