From 2db10e3e72125d5a529c50e0f352ae56aca2f510 Mon Sep 17 00:00:00 2001 From: Ben Alpert Date: Sat, 7 Nov 2015 11:39:11 -0800 Subject: [PATCH] Fix open source Summary: Unfortunately ReactTestUtils requires ReactDOM (for renderIntoDocument), and ReactTestUtils is required by ReactNative. This worked internally because we already shimmed ReactDOM for Relay; now we shim it externally too, at least until we figure out a better solution for this in React. public Reviewed By: vjeux Differential Revision: D2629811 fb-gh-sync-id: 94aac2c4eda39d039fdcedd88295e7afb0f5c5b2 --- .flowconfig | 1 + Libraries/ReactNative/ReactDOM.js | 16 ++++++++++++++++ packager/blacklist.js | 1 + 3 files changed, 18 insertions(+) create mode 100644 Libraries/ReactNative/ReactDOM.js diff --git a/.flowconfig b/.flowconfig index fcd3d60eb..88093d65f 100644 --- a/.flowconfig +++ b/.flowconfig @@ -18,6 +18,7 @@ .*/node_modules/fbjs-haste/crypto/crc32.js .*/node_modules/fbjs-haste/stubs/ErrorUtils.js .*/node_modules/react-haste/React.js +.*/node_modules/react-haste/renderers/dom/ReactDOM.js .*/node_modules/react-haste/renderers/shared/event/eventPlugins/ResponderEventPlugin.js # Ignore commoner tests diff --git a/Libraries/ReactNative/ReactDOM.js b/Libraries/ReactNative/ReactDOM.js new file mode 100644 index 000000000..7ac737c13 --- /dev/null +++ b/Libraries/ReactNative/ReactDOM.js @@ -0,0 +1,16 @@ +/** + * Copyright 2004-present Facebook. All Rights Reserved. + * + * @providesModule ReactDOM + */ + +'use strict'; + +var ReactUpdates = require('ReactUpdates'); + +// Temporary shim required for ReactTestUtils and Relay. +var ReactDOM = { + unstable_batchedUpdates: ReactUpdates.batchedUpdates, +}; + +module.exports = ReactDOM; diff --git a/packager/blacklist.js b/packager/blacklist.js index 36be002b4..bb64f7525 100644 --- a/packager/blacklist.js +++ b/packager/blacklist.js @@ -15,6 +15,7 @@ var path = require('path'); var sharedBlacklist = [ 'node_modules/react-haste/renderers/shared/event/eventPlugins/ResponderEventPlugin.js', 'node_modules/react-haste/React.js', + 'node_modules/react-haste/renderers/dom/ReactDOM.js', // For each of these fbjs files (especially the non-forks/stubs), we should // consider deleting the conflicting copy and just using the fbjs version.