@@ -349,7 +349,7 @@ class QueueAnim extends React.Component {
349
349
delay : interval * order + delay ,
350
350
duration,
351
351
easing : this . getVelocityEasing ( key , i ) [ 1 ] ,
352
- begin : this . leaveBegin . bind ( this ) ,
352
+ begin : this . leaveBegin . bind ( this , key ) ,
353
353
complete : this . leaveComplete . bind ( this , key ) ,
354
354
} ) ;
355
355
}
@@ -362,6 +362,9 @@ class QueueAnim extends React.Component {
362
362
elem . className += ( ` ${ animatingClassName [ 0 ] } ` ) ;
363
363
}
364
364
} ) ;
365
+ if ( this . props . onStart ) {
366
+ this . props . onStart ( { key, type : 'enter' } ) ;
367
+ }
365
368
}
366
369
367
370
enterComplete ( key , elements ) {
@@ -371,16 +374,22 @@ class QueueAnim extends React.Component {
371
374
elements . forEach ( ( elem ) => {
372
375
elem . className = elem . className . replace ( this . props . animatingClassName [ 0 ] , '' ) . trim ( ) ;
373
376
} ) ;
377
+ if ( this . props . onEnd ) {
378
+ this . props . onEnd ( { key, type : 'enter' } ) ;
379
+ }
374
380
}
375
381
376
- leaveBegin ( elements ) {
382
+ leaveBegin ( key , elements ) {
377
383
elements . forEach ( ( elem ) => {
378
384
const animatingClassName = this . props . animatingClassName ;
379
385
elem . className = elem . className . replace ( animatingClassName [ 0 ] , '' ) ;
380
386
if ( elem . className . indexOf ( animatingClassName [ 1 ] ) === - 1 ) {
381
387
elem . className += ( ` ${ animatingClassName [ 1 ] } ` ) ;
382
388
}
383
389
} ) ;
390
+ if ( this . props . onStart ) {
391
+ this . props . onStart ( { key, type : 'leave' } ) ;
392
+ }
384
393
}
385
394
386
395
leaveComplete ( key , elements ) {
@@ -404,6 +413,9 @@ class QueueAnim extends React.Component {
404
413
elements . forEach ( ( elem ) => {
405
414
elem . className = elem . className . replace ( this . props . animatingClassName [ 1 ] , '' ) . trim ( ) ;
406
415
} ) ;
416
+ if ( this . props . onEnd ) {
417
+ this . props . onEnd ( { key, type : 'leave' } ) ;
418
+ }
407
419
}
408
420
409
421
render ( ) {
@@ -431,6 +443,8 @@ class QueueAnim extends React.Component {
431
443
'leaveReverse' ,
432
444
'animatingClassName' ,
433
445
'enterForcedRePlay' ,
446
+ 'onStart' ,
447
+ 'onEnd' ,
434
448
] . forEach ( key => delete tagProps [ key ] ) ;
435
449
return createElement ( this . props . component , { ...tagProps } , childrenToRender ) ;
436
450
}
@@ -455,6 +469,8 @@ QueueAnim.propTypes = {
455
469
leaveReverse : React . PropTypes . bool ,
456
470
enterForcedRePlay : React . PropTypes . bool ,
457
471
animatingClassName : React . PropTypes . array ,
472
+ onStart : React . PropTypes . func ,
473
+ onEnd : React . PropTypes . func ,
458
474
} ;
459
475
460
476
QueueAnim . defaultProps = {
0 commit comments