Skip to content

Commit e5f76ab

Browse files
committed
fix leaving the unfinished unmount warning
1 parent a8e0e4b commit e5f76ab

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

src/QueueAnim.jsx

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,28 @@ import React, { createElement, cloneElement } from 'react';
22
import { findDOMNode } from 'react-dom';
33

44
const _ease = {
5-
easeInElastic: function(_p, o, t) {
5+
easeInElastic: (_p, o, t) => {
66
let p = _p;
77
const _p1 = o >= 1 ? o : 1;
88
const _p2 = (t || 1) / (o < 1 ? o : 1);
99
const _p3 = _p2 / Math.PI * 2 * (Math.asin(1 / _p1) || 0);
1010
return -(_p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin((p - _p3) * _p2));
1111
},
12-
easeOutElastic: function(p, o, t) {
12+
easeOutElastic: (p, o, t) => {
1313
const _p1 = o >= 1 ? o : 1;
1414
const _p2 = (t || 1) / (o < 1 ? o : 1);
1515
const _p3 = _p2 / Math.PI * 2 * (Math.asin(1 / _p1) || 0);
1616
return _p1 * Math.pow(2, -10 * p) * Math.sin((p - _p3) * _p2) + 1;
1717
},
18-
easeInOutElastic: function(_p, o, t) {
18+
easeInOutElastic: (_p, o, t) => {
1919
let p = _p;
2020
const _p1 = o >= 1 ? o : 1;
2121
const _p2 = (t || 1) / (o < 1 ? o : 1);
2222
const _p3 = _p2 / Math.PI * 2 * (Math.asin(1 / _p1) || 0);
2323
p *= 2;
2424
return p < 1 ? -0.5 * (_p1 * Math.pow(2, 10 * (p -= 1)) * Math.sin((p - _p3) * _p2)) : _p1 * Math.pow(2, -10 * (p -= 1)) * Math.sin((p - _p3) * _p2) * 0.5 + 1;
2525
},
26-
easeInBounce: function(_p) {
26+
easeInBounce: (_p) => {
2727
let p = _p;
2828
const __p = 1 - p;
2929
if (__p < 1 / 2.75) {
@@ -35,7 +35,7 @@ const _ease = {
3535
}
3636
return 1 - (7.5625 * (p -= 2.625 / 2.75) * p + 0.984375);
3737
},
38-
easeOutBounce: function(_p) {
38+
easeOutBounce: (_p) => {
3939
let p = _p;
4040
if (p < 1 / 2.75) {
4141
return 7.5625 * p * p;
@@ -46,7 +46,7 @@ const _ease = {
4646
}
4747
return 7.5625 * (p -= 2.625 / 2.75) * p + 0.984375;
4848
},
49-
easeInOutBounce: function(_p) {
49+
easeInOutBounce: (_p) => {
5050
let p = _p;
5151
const invert = (p < 0.5);
5252
if (invert) {
@@ -82,9 +82,9 @@ if (typeof document !== 'undefined' && typeof window !== 'undefined') {
8282
const callback = arguments[arguments.length - 1];
8383
// call after stack flushes
8484
// in case you app depends on the asyncron nature of this function
85-
setImmediate(function() {
86-
callback();
87-
});
85+
setImmediate(() =>
86+
callback()
87+
);
8888
};
8989
}
9090

@@ -193,16 +193,12 @@ class QueueAnim extends React.Component {
193193
}
194194

195195
componentWillUnmount() {
196-
if (this.originalChildren && this.originalChildren.length > 0) {
197-
this.originalChildren.forEach(child => {
198-
if (child && this.refs[child.key]) {
199-
velocity(findDOMNode(this.refs[child.key]), 'stop');
200-
}
201-
});
202-
Object.keys(this.placeholderTimeoutIds).forEach(key => {
203-
clearTimeout(this.placeholderTimeoutIds[key]);
204-
});
205-
}
196+
[].concat(this.keysToEnter, this.keysToLeave, this.keysAnimating).forEach(key =>
197+
velocity(findDOMNode(this.refs[key]), 'stop')
198+
);
199+
Object.keys(this.placeholderTimeoutIds).forEach(key => {
200+
clearTimeout(this.placeholderTimeoutIds[key]);
201+
});
206202
}
207203

208204
getVelocityConfig(index, ...args) {

0 commit comments

Comments
 (0)