@@ -2,7 +2,7 @@ import React, { createElement, cloneElement } from 'react';
2
2
import { findDOMNode } from 'react-dom' ;
3
3
4
4
let velocity ;
5
- if ( typeof document !== 'undefined' && typeof window !== 'undefined' ) {
5
+ if ( typeof document !== 'undefined' && typeof window !== 'undefined' ) {
6
6
// only load velocity on the client
7
7
velocity = require ( 'velocity-animate' ) ;
8
8
} else {
@@ -11,7 +11,9 @@ if ( typeof document !== 'undefined' && typeof window !== 'undefined' ) {
11
11
const callback = arguments [ arguments . length - 1 ] ;
12
12
// call after stack flushes
13
13
// in case you app depends on the asyncron nature of this function
14
- setImmediate ( function ( ) { callback ( ) ; } ) ;
14
+ setImmediate ( function ( ) {
15
+ callback ( ) ;
16
+ } ) ;
15
17
} ;
16
18
}
17
19
@@ -21,7 +23,7 @@ import {
21
23
mergeChildren ,
22
24
transformArguments ,
23
25
getChildrenFromProps ,
24
- } from './utils' ;
26
+ } from './utils' ;
25
27
import AnimTypes from './animTypes' ;
26
28
27
29
const BackEase = {
@@ -223,7 +225,13 @@ class QueueAnim extends React.Component {
223
225
224
226
enterBegin ( key , elements ) {
225
227
elements . forEach ( ( elem ) => {
226
- elem . className += ( ' ' + this . props . animatingClassName [ 0 ] ) ;
228
+ const animatingClassName = this . props . animatingClassName ;
229
+ if ( elem . className . indexOf ( animatingClassName [ 1 ] ) >= 0 ) {
230
+ elem . className = elem . className . replace ( animatingClassName [ 1 ] , '' ) ;
231
+ }
232
+ if ( elem . className . indexOf ( ' ' + animatingClassName [ 0 ] ) === - 1 ) {
233
+ elem . className += ( ' ' + animatingClassName [ 0 ] ) ;
234
+ }
227
235
} ) ;
228
236
}
229
237
@@ -238,7 +246,13 @@ class QueueAnim extends React.Component {
238
246
239
247
leaveBegin ( elements ) {
240
248
elements . forEach ( ( elem ) => {
241
- elem . className += ( ' ' + this . props . animatingClassName [ 1 ] ) ;
249
+ const animatingClassName = this . props . animatingClassName ;
250
+ if ( elem . className . indexOf ( animatingClassName [ 0 ] ) >= 0 ) {
251
+ elem . className = elem . className . replace ( animatingClassName [ 0 ] , '' ) ;
252
+ }
253
+ if ( elem . className . indexOf ( animatingClassName [ 1 ] ) === - 1 ) {
254
+ elem . className += ( ' ' + animatingClassName [ 1 ] ) ;
255
+ }
242
256
} ) ;
243
257
}
244
258
0 commit comments