diff --git a/src/addons/ReactAddonsDOMDependencies.js b/src/addons/ReactAddonsDOMDependencies.js index e0b5eb45a5e42..327cfbf700d0d 100644 --- a/src/addons/ReactAddonsDOMDependencies.js +++ b/src/addons/ReactAddonsDOMDependencies.js @@ -12,16 +12,11 @@ 'use strict'; var ReactDOM = require('ReactDOM'); -var ReactInstanceMap = require('ReactInstanceMap'); exports.getReactDOM = function() { return ReactDOM; }; -exports.getReactInstanceMap = function() { - return ReactInstanceMap; -}; - if (__DEV__) { var ReactPerf = require('ReactPerf'); var ReactTestUtils = require('ReactTestUtils'); diff --git a/src/addons/transitions/ReactTransitionGroup.js b/src/addons/transitions/ReactTransitionGroup.js index 001b06fb9d0e0..62372801fa3fd 100644 --- a/src/addons/transitions/ReactTransitionGroup.js +++ b/src/addons/transitions/ReactTransitionGroup.js @@ -12,7 +12,6 @@ 'use strict'; var React = require('React'); -var ReactAddonsDOMDependencies = require('ReactAddonsDOMDependencies'); var ReactTransitionChildMapping = require('ReactTransitionChildMapping'); var emptyFunction = require('emptyFunction'); @@ -56,17 +55,9 @@ class ReactTransitionGroup extends React.Component { } componentWillReceiveProps(nextProps) { - var nextChildMapping; - if (__DEV__) { - nextChildMapping = ReactTransitionChildMapping.getChildMapping( - nextProps.children, - ReactAddonsDOMDependencies.getReactInstanceMap().get(this)._debugID - ); - } else { - nextChildMapping = ReactTransitionChildMapping.getChildMapping( - nextProps.children - ); - } + var nextChildMapping = ReactTransitionChildMapping.getChildMapping( + nextProps.children + ); var prevChildMapping = this.state.children; this.setState({ @@ -129,17 +120,9 @@ class ReactTransitionGroup extends React.Component { delete this.currentlyTransitioningKeys[key]; - var currentChildMapping; - if (__DEV__) { - currentChildMapping = ReactTransitionChildMapping.getChildMapping( - this.props.children, - ReactAddonsDOMDependencies.getReactInstanceMap().get(this)._debugID - ); - } else { - currentChildMapping = ReactTransitionChildMapping.getChildMapping( - this.props.children - ); - } + var currentChildMapping = ReactTransitionChildMapping.getChildMapping( + this.props.children + ); if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { // This was removed before it had fully appeared. Remove it. @@ -169,17 +152,9 @@ class ReactTransitionGroup extends React.Component { delete this.currentlyTransitioningKeys[key]; - var currentChildMapping; - if (__DEV__) { - currentChildMapping = ReactTransitionChildMapping.getChildMapping( - this.props.children, - ReactAddonsDOMDependencies.getReactInstanceMap().get(this)._debugID - ); - } else { - currentChildMapping = ReactTransitionChildMapping.getChildMapping( - this.props.children - ); - } + var currentChildMapping = ReactTransitionChildMapping.getChildMapping( + this.props.children + ); if (!currentChildMapping || !currentChildMapping.hasOwnProperty(key)) { // This was removed before it had fully entered. Remove it. @@ -210,17 +185,9 @@ class ReactTransitionGroup extends React.Component { delete this.currentlyTransitioningKeys[key]; - var currentChildMapping; - if (__DEV__) { - currentChildMapping = ReactTransitionChildMapping.getChildMapping( - this.props.children, - ReactAddonsDOMDependencies.getReactInstanceMap().get(this)._debugID - ); - } else { - currentChildMapping = ReactTransitionChildMapping.getChildMapping( - this.props.children - ); - } + var currentChildMapping = ReactTransitionChildMapping.getChildMapping( + this.props.children + ); if (currentChildMapping && currentChildMapping.hasOwnProperty(key)) { // This entered again before it fully left. Add it again. diff --git a/src/umd/ReactDOMUMDEntry.js b/src/umd/ReactDOMUMDEntry.js index 59daf4bef9c61..03a0318a10503 100644 --- a/src/umd/ReactDOMUMDEntry.js +++ b/src/umd/ReactDOMUMDEntry.js @@ -11,24 +11,24 @@ 'use strict'; +var React = require('React'); var ReactDOM = require('ReactDOM'); -var ReactDOMUMDEntry = Object.assign({ - __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { - ReactInstanceMap: require('ReactInstanceMap'), - }, -}, ReactDOM); +var ReactDOMUMDEntry = ReactDOM; if (__DEV__) { - Object.assign( - ReactDOMUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, - { - // ReactPerf and ReactTestUtils currently only work with the DOM renderer - // so we expose them from here, but only in DEV mode. - ReactPerf: require('ReactPerf'), - ReactTestUtils: require('ReactTestUtils'), - } - ); + ReactDOMUMDEntry.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = { + // ReactPerf and ReactTestUtils currently only work with the DOM renderer + // so we expose them from here, but only in DEV mode. + ReactPerf: require('ReactPerf'), + ReactTestUtils: require('ReactTestUtils'), + }; +} + +// Inject ReactDOM into React for the addons UMD build that depends on ReactDOM (TransitionGroup). +// We can remove this after we deprecate and remove the addons UMD build. +if (React.addons) { + React.__SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactDOMUMDEntry; } module.exports = ReactDOMUMDEntry; diff --git a/src/umd/ReactWithAddonsUMDEntry.js b/src/umd/ReactWithAddonsUMDEntry.js index ad05b565c932e..c59e62e731ea9 100644 --- a/src/umd/ReactWithAddonsUMDEntry.js +++ b/src/umd/ReactWithAddonsUMDEntry.js @@ -15,6 +15,7 @@ var ReactWithAddons = require('ReactWithAddons'); // `version` will be added here by the React module. var ReactWithAddonsUMDEntry = Object.assign({ + __SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: null, // Will be injected by ReactDOM UMD build. __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: { ReactCurrentOwner: require('ReactCurrentOwner'), }, diff --git a/src/umd/shims/ReactAddonsDOMDependenciesUMDShim.js b/src/umd/shims/ReactAddonsDOMDependenciesUMDShim.js index 2aa7b886b544b..e725c048008c0 100644 --- a/src/umd/shims/ReactAddonsDOMDependenciesUMDShim.js +++ b/src/umd/shims/ReactAddonsDOMDependenciesUMDShim.js @@ -9,16 +9,12 @@ * @providesModule ReactAddonsDOMDependenciesUMDShim */ -/* globals ReactDOM */ - 'use strict'; exports.getReactDOM = function() { - return ReactDOM; -}; - -exports.getReactInstanceMap = function() { - return ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactInstanceMap; + var ReactWithAddonsUMDEntry = require('ReactWithAddonsUMDEntry'); + // This is injected by the ReactDOM UMD build: + return ReactWithAddonsUMDEntry.__SECRET_INJECTED_REACT_DOM_DO_NOT_USE_OR_YOU_WILL_BE_FIRED; }; if (__DEV__) {