Skip to content

Commit

Permalink
store nodeRef in ReactCSSTransitionGroupChild
Browse files Browse the repository at this point in the history
  • Loading branch information
Keyan Zhang committed Jun 3, 2016
1 parent aca7a1b commit 414f38d
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/addons/transitions/ReactCSSTransitionGroupChild.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ var ReactCSSTransitionGroupChild = React.createClass({
CSSCore.addClass(node, className);

// Need to do this to actually trigger a transition.
this.queueClass(activeClassName);
this.queueClass(activeClassName, node);

// If the user specified a timeout delay.
if (userSpecifiedDelay) {
Expand All @@ -102,8 +102,9 @@ var ReactCSSTransitionGroupChild = React.createClass({
}
},

queueClass: function(className) {
queueClass: function(className, nodeRef) {
this.classNameQueue.push(className);
this.nodeRef = nodeRef;

if (!this.timeout) {
this.timeout = setTimeout(this.flushClassNameQueue, TICK);
Expand All @@ -113,7 +114,7 @@ var ReactCSSTransitionGroupChild = React.createClass({
flushClassNameQueue: function() {
if (this.isMounted()) {
this.classNameQueue.forEach(
CSSCore.addClass.bind(CSSCore, ReactDOM.findDOMNode(this))
CSSCore.addClass.bind(CSSCore, this.nodeRef)
);
}
this.classNameQueue.length = 0;
Expand All @@ -132,6 +133,9 @@ var ReactCSSTransitionGroupChild = React.createClass({
this.transitionTimeouts.forEach(function(timeout) {
clearTimeout(timeout);
});
if (this.nodeRef) {
this.nodeRef = null;
}
},

componentWillAppear: function(done) {
Expand Down

0 comments on commit 414f38d

Please sign in to comment.