|
11 | 11 | */ |
12 | 12 | 'use strict'; |
13 | 13 |
|
14 | | -// Require ReactNativeDefaultInjection first for its side effects of setting up |
15 | | -// the JS environment |
16 | | -var ReactNativeComponentTree = require('ReactNativeComponentTree'); |
17 | | -var ReactNativeInjection = require('ReactNativeInjection'); |
18 | | -var ReactNativeStackInjection = require('ReactNativeStackInjection'); |
| 14 | +const ReactNativeFeatureFlags = require('ReactNativeFeatureFlags'); |
19 | 15 |
|
20 | | -var ReactNativeMount = require('ReactNativeMount'); |
21 | | -var ReactUpdates = require('ReactUpdates'); |
22 | | - |
23 | | -var findNodeHandle = require('findNodeHandle'); |
24 | | - |
25 | | -ReactNativeInjection.inject(); |
26 | | -ReactNativeStackInjection.inject(); |
27 | | - |
28 | | -var render = function( |
29 | | - element: ReactElement<any>, |
30 | | - mountInto: number, |
31 | | - callback?: ?(() => void) |
32 | | -): ?ReactComponent<any, any, any> { |
33 | | - return ReactNativeMount.renderComponent(element, mountInto, callback); |
34 | | -}; |
35 | | - |
36 | | -var ReactNative = { |
37 | | - hasReactNativeInitialized: false, |
38 | | - findNodeHandle: findNodeHandle, |
39 | | - render: render, |
40 | | - unmountComponentAtNode: ReactNativeMount.unmountComponentAtNode, |
41 | | - |
42 | | - /* eslint-disable camelcase */ |
43 | | - unstable_batchedUpdates: ReactUpdates.batchedUpdates, |
44 | | - /* eslint-enable camelcase */ |
45 | | - |
46 | | - unmountComponentAtNodeAndRemoveContainer: ReactNativeMount.unmountComponentAtNodeAndRemoveContainer, |
47 | | -}; |
48 | | - |
49 | | -// Inject the runtime into a devtools global hook regardless of browser. |
50 | | -// Allows for debugging when the hook is injected on the page. |
51 | | -/* globals __REACT_DEVTOOLS_GLOBAL_HOOK__ */ |
52 | | -if ( |
53 | | - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ !== 'undefined' && |
54 | | - typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.inject === 'function') { |
55 | | - __REACT_DEVTOOLS_GLOBAL_HOOK__.inject({ |
56 | | - ComponentTree: { |
57 | | - getClosestInstanceFromNode: function(node) { |
58 | | - return ReactNativeComponentTree.getClosestInstanceFromNode(node); |
59 | | - }, |
60 | | - getNodeFromInstance: function(inst) { |
61 | | - // inst is an internal instance (but could be a composite) |
62 | | - while (inst._renderedComponent) { |
63 | | - inst = inst._renderedComponent; |
64 | | - } |
65 | | - if (inst) { |
66 | | - return ReactNativeComponentTree.getNodeFromInstance(inst); |
67 | | - } else { |
68 | | - return null; |
69 | | - } |
70 | | - }, |
71 | | - }, |
72 | | - Mount: ReactNativeMount, |
73 | | - Reconciler: require('ReactReconciler'), |
74 | | - }); |
75 | | -} |
76 | | - |
77 | | -module.exports = ReactNative; |
| 16 | +module.exports = ReactNativeFeatureFlags.useFiber |
| 17 | + ? require('ReactNativeFiber') |
| 18 | + : require('ReactNativeStack'); |
0 commit comments