@@ -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,6 +225,9 @@ class QueueAnim extends React.Component {
223
225
224
226
enterBegin ( key , elements ) {
225
227
elements . forEach ( ( elem ) => {
228
+ const currentClassName = this . props . animatingClassName [ 1 ] ;
229
+ const reg = new RegExp ( currentClassName , 'ig' ) ;
230
+ elem . className = elem . className . replace ( reg , '' ) ;
226
231
elem . className += ( ' ' + this . props . animatingClassName [ 0 ] ) ;
227
232
} ) ;
228
233
}
@@ -232,12 +237,17 @@ class QueueAnim extends React.Component {
232
237
this . keysAnimating . splice ( this . keysAnimating . indexOf ( key ) , 1 ) ;
233
238
}
234
239
elements . forEach ( ( elem ) => {
235
- elem . className = elem . className . replace ( this . props . animatingClassName [ 0 ] , '' ) . trim ( ) ;
240
+ const currentClassName = this . props . animatingClassName [ 0 ] ;
241
+ const reg = new RegExp ( currentClassName , 'ig' ) ;
242
+ elem . className = elem . className . replace ( reg , '' ) . trim ( ) ;
236
243
} ) ;
237
244
}
238
245
239
246
leaveBegin ( elements ) {
240
247
elements . forEach ( ( elem ) => {
248
+ const currentClassName = this . props . animatingClassName [ 0 ] ;
249
+ const reg = new RegExp ( currentClassName , 'ig' ) ;
250
+ elem . className = elem . className . replace ( reg , '' ) ;
241
251
elem . className += ( ' ' + this . props . animatingClassName [ 1 ] ) ;
242
252
} ) ;
243
253
}
@@ -261,7 +271,9 @@ class QueueAnim extends React.Component {
261
271
} ) ;
262
272
}
263
273
elements . forEach ( ( elem ) => {
264
- elem . className = elem . className . replace ( this . props . animatingClassName [ 1 ] , '' ) . trim ( ) ;
274
+ const currentClassName = this . props . animatingClassName [ 1 ] ;
275
+ const reg = new RegExp ( currentClassName , 'ig' ) ;
276
+ elem . className = elem . className . replace ( reg , '' ) . trim ( ) ;
265
277
} ) ;
266
278
}
267
279
0 commit comments