renderTransitionableChildren: function(sourceChildren) { var children = {}; var childMapping = ReactTransitionKeySet.getChildMapping(sourceChildren); var currentKeys = ReactTransitionKeySet.mergeKeySets( this._transitionGroupCurrentKeys, ReactTransitionKeySet.getKeySet(sourceChildren) ); for (var key in currentKeys) { // Here is how we keep the nodes in the DOM. ReactTransitionableChild // knows how to hold onto its child if it changes to undefined. Here, we // may look up an old key in the new children, and it may switch to // undefined. React's reconciler will keep the ReactTransitionableChild // instance alive such that we can animate it. if (childMapping[key] || this.props.transitionLeave) { children[key] = ReactTransitionableChild({ name: this.props.transitionName, enter: this.props.transitionEnter, onDoneLeaving: this._handleDoneLeaving.bind(this, key) }, childMapping[key]); } } this._transitionGroupCurrentKeys = currentKeys; return children; },
renderTransitionableChildren: function(sourceChildren) { var children = {}; var childMapping = ReactTransitionKeySet.getChildMapping(sourceChildren); var prevKeys = this._transitionGroupCurrentKeys; var currentKeys = ReactTransitionKeySet.mergeKeySets( prevKeys, ReactTransitionKeySet.getKeySet(sourceChildren) ); for (var key in currentKeys) { // Here is how we keep the nodes in the DOM. ReactTransitionableChild // knows how to hold onto its child if it changes to undefined. Here, we // may look up an old key in the new children, and it may switch to // undefined. React's reconciler will keep the ReactTransitionableChild // instance alive such that we can animate it. if (childMapping[key] || (this.props.transitionLeave && prevKeys[key])) { children[key] = ReactTransitionableChild({ name: this.props.transitionName, enter: this.props.transitionEnter, onDoneLeaving: this._handleDoneLeaving.bind(this, key) }, childMapping[key]); } else { // If there's no leave transition and the child has been removed from // the source children list, we want to remove it immediately from the // _transitionGroupCurrentKeys cache because _handleDoneLeaving won't // be called. In normal cases, this prevents a small memory leak; in // the case of switching transitionLeave from false to true, it // prevents a confusing bug where ReactTransitionableChild.render() // returns nothing, throwing an error. delete currentKeys[key]; } } this._transitionGroupCurrentKeys = currentKeys; return children; },