diff --git a/packages/react-native-renderer/src/ReactFabric.js b/packages/react-native-renderer/src/ReactFabric.js index 711f1e96ec..64df3ee557 100644 --- a/packages/react-native-renderer/src/ReactFabric.js +++ b/packages/react-native-renderer/src/ReactFabric.js @@ -10,7 +10,7 @@ import type {ReactNativeType} from './ReactNativeTypes'; import type {ReactNodeList} from 'shared/ReactTypes'; -import './ReactNativeInjection'; +import './ReactFabricInjection'; import * as ReactPortal from 'shared/ReactPortal'; import * as ReactGenericBatching from 'events/ReactGenericBatching'; diff --git a/packages/react-native-renderer/src/ReactFabricInjection.js b/packages/react-native-renderer/src/ReactFabricInjection.js new file mode 100644 index 0000000000..eb4c2bca3f --- /dev/null +++ b/packages/react-native-renderer/src/ReactFabricInjection.js @@ -0,0 +1,23 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + */ + +import './ReactNativeInjectionShared'; + +// TODO: The event emitter registration is interfering with the existing +// ReactNative renderer. So disable it for Fabric for now. + +// import * as ReactNativeEventEmitter from './ReactNativeEventEmitter'; + +// Module provided by RN: +// import RCTEventEmitter from 'RCTEventEmitter'; + +/** + * Register the event emitter with the native bridge + */ +// RCTEventEmitter.register(ReactNativeEventEmitter); diff --git a/packages/react-native-renderer/src/ReactNativeInjection.js b/packages/react-native-renderer/src/ReactNativeInjection.js index 63441778b0..df5a468cd1 100644 --- a/packages/react-native-renderer/src/ReactNativeInjection.js +++ b/packages/react-native-renderer/src/ReactNativeInjection.js @@ -7,47 +7,14 @@ * @flow */ -/** - * Make sure essential globals are available and are patched correctly. Please don't remove this - * line. Bundles created by react-packager `require` it before executing any application code. This - * ensures it exists in the dependency graph and can be `require`d. - * TODO: require this in packager, not in React #10932517 - */ -// Module provided by RN: -import 'InitializeCore'; +import './ReactNativeInjectionShared'; + +import * as ReactNativeEventEmitter from './ReactNativeEventEmitter'; -import * as EventPluginHub from 'events/EventPluginHub'; -import * as EventPluginUtils from 'events/EventPluginUtils'; -import ResponderEventPlugin from 'events/ResponderEventPlugin'; // Module provided by RN: import RCTEventEmitter from 'RCTEventEmitter'; -import ReactNativeBridgeEventPlugin from './ReactNativeBridgeEventPlugin'; -import * as ReactNativeComponentTree from './ReactNativeComponentTree'; -import * as ReactNativeEventEmitter from './ReactNativeEventEmitter'; -import ReactNativeEventPluginOrder from './ReactNativeEventPluginOrder'; -import ReactNativeGlobalResponderHandler from './ReactNativeGlobalResponderHandler'; - /** * Register the event emitter with the native bridge */ RCTEventEmitter.register(ReactNativeEventEmitter); - -/** - * Inject module for resolving DOM hierarchy and plugin ordering. - */ -EventPluginHub.injection.injectEventPluginOrder(ReactNativeEventPluginOrder); -EventPluginUtils.injection.injectComponentTree(ReactNativeComponentTree); - -ResponderEventPlugin.injection.injectGlobalResponderHandler( - ReactNativeGlobalResponderHandler, -); - -/** - * Some important event plugins included by default (without having to require - * them). - */ -EventPluginHub.injection.injectEventPluginsByName({ - ResponderEventPlugin: ResponderEventPlugin, - ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin, -}); diff --git a/packages/react-native-renderer/src/ReactNativeInjectionShared.js b/packages/react-native-renderer/src/ReactNativeInjectionShared.js new file mode 100644 index 0000000000..cc35fdebe9 --- /dev/null +++ b/packages/react-native-renderer/src/ReactNativeInjectionShared.js @@ -0,0 +1,45 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * @flow + */ + +/** + * Make sure essential globals are available and are patched correctly. Please don't remove this + * line. Bundles created by react-packager `require` it before executing any application code. This + * ensures it exists in the dependency graph and can be `require`d. + * TODO: require this in packager, not in React #10932517 + */ +// Module provided by RN: +import 'InitializeCore'; + +import * as EventPluginHub from 'events/EventPluginHub'; +import * as EventPluginUtils from 'events/EventPluginUtils'; +import ResponderEventPlugin from 'events/ResponderEventPlugin'; + +import ReactNativeBridgeEventPlugin from './ReactNativeBridgeEventPlugin'; +import * as ReactNativeComponentTree from './ReactNativeComponentTree'; +import ReactNativeEventPluginOrder from './ReactNativeEventPluginOrder'; +import ReactNativeGlobalResponderHandler from './ReactNativeGlobalResponderHandler'; + +/** + * Inject module for resolving DOM hierarchy and plugin ordering. + */ +EventPluginHub.injection.injectEventPluginOrder(ReactNativeEventPluginOrder); +EventPluginUtils.injection.injectComponentTree(ReactNativeComponentTree); + +ResponderEventPlugin.injection.injectGlobalResponderHandler( + ReactNativeGlobalResponderHandler, +); + +/** + * Some important event plugins included by default (without having to require + * them). + */ +EventPluginHub.injection.injectEventPluginsByName({ + ResponderEventPlugin: ResponderEventPlugin, + ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin, +});