@@ -107,6 +107,9 @@ const BackEase = {
107
107
108
108
const placeholderKeyPrefix = 'ant-queue-anim-placeholder-' ;
109
109
110
+ const noop = ( ) => {
111
+ } ;
112
+
110
113
class QueueAnim extends React . Component {
111
114
constructor ( ) {
112
115
super ( ...arguments ) ;
@@ -262,27 +265,35 @@ class QueueAnim extends React.Component {
262
265
* 而不是 animTypes 里的初始值,如果是初始值将会跳动。
263
266
*/
264
267
const data = { ...assignChild ( velocityConfig ) } ;
265
- const transformsBase = velocity &&
268
+ const transformsBase = velocity && velocity . prototype . constructor &&
266
269
velocity . prototype . constructor . CSS . Lists . transformsBase || [ ] ;
270
+ const setPropertyValue = velocity && velocity . prototype . constructor &&
271
+ velocity . prototype . constructor . CSS . setPropertyValue || noop ;
272
+ const getUnitType = velocity && velocity . prototype . constructor &&
273
+ velocity . prototype . constructor . CSS . Values . getUnitType || noop ;
267
274
const nodeStyle = node . style ;
268
275
Object . keys ( data ) . forEach ( dataKey => {
276
+ let cssName = dataKey ;
269
277
if ( transformsBase . indexOf ( dataKey ) >= 0 ) {
270
- const transformString = nodeStyle [ checkStyleName ( 'transform' ) ] ;
278
+ cssName = 'transform' ;
279
+ const transformString = nodeStyle [ checkStyleName ( cssName ) ] ;
271
280
if ( transformString && transformString !== 'none' ) {
272
281
if ( transformString . match ( dataKey ) ) {
273
282
const rep = new RegExp ( `^.*${ dataKey } \\(([^\\)]+?)\\).*` , 'i' ) ;
274
283
const transformData = transformString . replace ( rep , '$1' ) ;
275
284
data [ dataKey ] [ 1 ] = parseFloat ( transformData ) ;
276
285
return ;
277
286
}
287
+ } else {
288
+ data [ dataKey ] [ 1 ] = 0 ;
278
289
}
279
- data [ dataKey ] [ 1 ] = 0 ;
280
- }
281
- if ( nodeStyle [ dataKey ] && parseFloat ( nodeStyle [ dataKey ] ) ) {
290
+ } else if ( nodeStyle [ dataKey ] && parseFloat ( nodeStyle [ dataKey ] ) ) {
282
291
data [ dataKey ] [ 1 ] = parseFloat ( nodeStyle [ dataKey ] ) ;
283
292
} else {
284
293
data [ dataKey ] [ 1 ] = 0 ;
285
294
}
295
+ // 先把初始值设进 style 里。免得跳动;把下面的设置放到这里。
296
+ setPropertyValue ( node , cssName , `${ data [ dataKey ] [ 1 ] } ${ getUnitType ( dataKey ) } ` ) ;
286
297
} ) ;
287
298
return data ;
288
299
} ;
@@ -334,22 +345,13 @@ class QueueAnim extends React.Component {
334
345
return ;
335
346
}
336
347
const interval = transformArguments ( this . props . interval , key , i ) [ 1 ] ;
337
- let delay = transformArguments ( this . props . delay , key , i ) [ 1 ] ;
338
- let duration = transformArguments ( this . props . duration , key , i ) [ 1 ] ;
348
+ const delay = transformArguments ( this . props . delay , key , i ) [ 1 ] ;
349
+ const duration = transformArguments ( this . props . duration , key , i ) [ 1 ] ;
339
350
const order = this . props . leaveReverse ? ( this . keysToLeave . length - i - 1 ) : i ;
340
351
velocity ( node , 'stop' ) ;
341
- delay = interval * order + delay ;
342
352
const data = this . getInitAnimType ( node , this . getVelocityLeaveConfig ( key , i ) ) ;
343
- // 当数据为 [0, 0] 时,,有延时的话会出现跳动。。。
344
- Object . keys ( data ) . forEach ( dataKey => {
345
- const item = data [ dataKey ] ;
346
- if ( Array . isArray ( item ) && item [ 0 ] === 0 && item [ 1 ] === 0 ) {
347
- delay = 0 ;
348
- duration = 0 ;
349
- }
350
- } ) ;
351
353
velocity ( node , data , {
352
- delay,
354
+ delay : interval * order + delay ,
353
355
duration,
354
356
easing : this . getVelocityEasing ( key , i ) [ 1 ] ,
355
357
begin : this . leaveBegin . bind ( this ) ,
0 commit comments