mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Merge pull request #642 from Cartas/master
ReactTransitionGroup can handle components being re-added before 'leave' transition has completed.
This commit is contained in:
@@ -129,6 +129,18 @@ var ReactTransitionableChild = React.createClass({
|
||||
componentWillReceiveProps: function(nextProps) {
|
||||
if (!nextProps.children && this.props.children) {
|
||||
this.savedChildren = this.props.children;
|
||||
} else if (nextProps.children && !this.props.children) {
|
||||
// We're being told to re-add the child. Let's stop leaving!
|
||||
if (this.isMounted()) {
|
||||
var node = this.getDOMNode();
|
||||
var className = this.props.name;
|
||||
CSSCore.removeClass(node, className + '-leave');
|
||||
CSSCore.removeClass(node, className + '-leave-active');
|
||||
if (this.props.enter) {
|
||||
CSSCore.addClass(node, className + '-enter');
|
||||
CSSCore.addClass(node, className + '-enter-active');
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user