Hack around to fix RN bundle

This commit is contained in:
Dan Abramov
2017-04-04 16:02:20 +01:00
parent 245c0820dd
commit 59445a6259
4 changed files with 15 additions and 4 deletions
+2
View File
@@ -227,9 +227,11 @@ const bundles = [
},
entry: 'src/renderers/native/ReactNative.js',
externals: [
'ExceptionsManager',
'InitializeCore',
'RCTEventEmitter',
'UIManager',
'View',
'deepDiffer',
'flattenStyle',
'TextInputState',
+1 -3
View File
@@ -21,8 +21,7 @@ var findNodeHandle = require('findNodeHandle');
var ReactNative;
// TODO: figure this out when we work on flat bundles in RN.
// This might not be needed after all.
// Works around a circular dependency in flat bundle.
function injectReactNative(RN: $FlowFixMe) {
ReactNative = RN;
}
@@ -159,7 +158,6 @@ var NativeMethodsMixin = {
TextInputState.blurTextInput(ReactNative.findNodeHandle(this));
},
// Temporary hack to avoid a circular dependency
__injectReactNative: injectReactNative,
};
+3
View File
@@ -12,12 +12,15 @@
var ReactNativeFeatureFlags = require('ReactNativeFeatureFlags');
var NativeMethodsMixin = require('NativeMethodsMixin');
var takeSnapshot = require('takeSnapshot');
var ReactNative = ReactNativeFeatureFlags.useFiber
? require('ReactNativeFiber')
: require('ReactNativeStack');
// Work around circular dependencies
NativeMethodsMixin.__injectReactNative(ReactNative);
takeSnapshot.__injectReactNative(ReactNative);
ReactNative.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = {
createReactNativeComponentClass: require('createReactNativeComponentClass'),
+9 -1
View File
@@ -11,9 +11,15 @@
*/
'use strict';
var ReactNative = require('ReactNative');
var UIManager = require('UIManager');
var ReactNative;
// Works around a circular dependency in flat bundle.
function injectReactNative(RN: $FlowFixMe) {
ReactNative = RN;
}
import type {Element} from 'React';
/**
@@ -51,4 +57,6 @@ function takeSnapshot(
return UIManager.__takeSnapshot(view, options);
}
takeSnapshot.__injectReactNative = injectReactNative;
module.exports = takeSnapshot;