@@ -26,6 +26,8 @@ class QueueAnim extends React.Component {
26
26
this . keysToLeave = [ ] ;
27
27
this . keysAnimating = [ ] ;
28
28
29
+ this . placeholder = { } ;
30
+
29
31
// 第一次进入,默认进场
30
32
const children = toArrayChildren ( getChildrenFromProps ( this . props ) ) ;
31
33
children . forEach ( child => {
@@ -148,22 +150,22 @@ class QueueAnim extends React.Component {
148
150
}
149
151
150
152
performEnter ( key , i ) {
151
- /*
152
- *占位符在暴击时是不存在的,所以用create
153
- */
154
- const placeholderNode = document . createElement ( 'div' ) ;
155
- if ( ! placeholderNode ) {
156
- return ;
157
- }
153
+ /* const placeholderNode = findDOMNode(this.refs[placeholderKeyPrefix + key]);
154
+ if (!placeholderNode) {
155
+ return;
156
+ }*/
157
+
158
158
const interval = transformArguments ( this . props . interval , key , i ) [ 0 ] ;
159
159
const delay = transformArguments ( this . props . delay , key , i ) [ 0 ] ;
160
- placeholderNode . style . visibility = 'hidden' ;
161
- velocity ( placeholderNode , 'stop' ) ;
162
- velocity ( placeholderNode , { opacity : [ 0 , 0 ] } , {
163
- delay : interval * i + delay ,
164
- duration : 0 ,
165
- begin : this . performEnterBegin . bind ( this , key , i ) ,
166
- } ) ;
160
+ /*
161
+ placeholderNode.style.visibility = 'hidden';
162
+ velocity(placeholderNode, 'stop', true);
163
+ velocity(placeholderNode, {opacity: [0, 0]}, {
164
+ delay: interval * i + delay,
165
+ duration: 0,
166
+ begin: this.performEnterBegin.bind(this, key, i),
167
+ });*/
168
+ this . placeholder [ key ] = setTimeout ( this . performEnterBegin . bind ( this , key , i ) , interval * i + delay ) ;
167
169
if ( this . keysToEnter . indexOf ( key ) >= 0 ) {
168
170
this . keysToEnter . splice ( this . keysToEnter . indexOf ( key ) , 1 ) ;
169
171
}
@@ -200,14 +202,19 @@ class QueueAnim extends React.Component {
200
202
201
203
performLeave ( key , i ) {
202
204
const node = findDOMNode ( this . refs [ key ] ) ;
205
+ /*
206
+ this.placeholder.forEach((item)=> {
207
+ velocity(item, 'stop', true);
208
+ });*/
209
+ clearTimeout ( this . placeholder [ key ] ) ;
203
210
if ( ! node ) {
204
211
return ;
205
212
}
206
213
const interval = transformArguments ( this . props . interval , key , i ) [ 1 ] ;
207
214
const delay = transformArguments ( this . props . delay , key , i ) [ 1 ] ;
208
215
const duration = transformArguments ( this . props . duration , key , i ) [ 1 ] ;
209
216
const order = this . props . leaveReverse ? ( this . keysToLeave . length - i - 1 ) : i ;
210
- velocity ( node , 'stop' ) ;
217
+ velocity ( node , 'stop' , true ) ;
211
218
velocity ( node , this . getVelocityLeaveConfig ( key , i ) , {
212
219
delay : interval * order + delay ,
213
220
duration : duration ,
@@ -248,7 +255,13 @@ class QueueAnim extends React.Component {
248
255
if ( this . keysToLeave . indexOf ( key ) >= 0 ) {
249
256
this . keysToLeave . splice ( this . keysToLeave . indexOf ( key ) , 1 ) ;
250
257
}
251
- if ( this . keysToLeave . length === 0 ) {
258
+ let leaveEnd ;
259
+ this . keysToLeave . forEach ( ( c ) => {
260
+ if ( childrenShow [ c ] ) {
261
+ leaveEnd = true ;
262
+ }
263
+ } ) ;
264
+ if ( ! leaveEnd ) {
252
265
const currentChildren = toArrayChildren ( getChildrenFromProps ( this . props ) ) ;
253
266
this . setState ( {
254
267
children : currentChildren ,
0 commit comments