@@ -154,7 +154,7 @@ class QueueAnim extends React.Component {
154
154
155
155
const childrenShow = this . state . childrenShow ;
156
156
if ( nextProps . enterForcedRePlay ) {
157
- // 在出场没结束时,childrenShow 里的值将不会清除。再触发进场时, childrenShow 里的值是保留着的,所以在这做下清除 。
157
+ // 在出场没结束时,childrenShow 里的值将不会清除。再触发进场时, childrenShow 里的值是保留着的, 设置了 enterForcedRePlay 将重新播放进场 。
158
158
newChildren . forEach ( item => {
159
159
if ( this . keysToLeave . indexOf ( item . key ) >= 0 ) {
160
160
const node = this . refs [ item . key ] ;
@@ -256,14 +256,14 @@ class QueueAnim extends React.Component {
256
256
257
257
getInitAnimType = ( node , _data ) => {
258
258
/*
259
- * 强行结束后,获取当前 dom 里是否有 data 里的 key 值,如果有,出场开始启动为 dom 里的值
260
- * 而不是 animTypes 里的初始值,如果是 初始值将会跳动。
259
+ * enterForcedRePlay 为 false 时:
260
+ * 强行结束后,获取当前 dom 里是否有 data 里的 key 值,
261
+ * 如果有,出场开始启动为 dom 里的值
262
+ * 而不是 animTypes 里的初始值,如果是初始值将会跳动。
261
263
*/
262
264
const data = Object . assign ( { } , assignChild ( _data ) ) ;
263
265
const transformsBase = velocity &&
264
266
velocity . prototype . constructor . CSS . Lists . transformsBase || [ ] ;
265
- // const setPropertyValue = velocity.prototype.constructor.CSS.setPropertyValue;
266
- // const getUnitType = velocity.prototype.constructor.CSS.Values.getUnitType;
267
267
const nodeStyle = node . style ;
268
268
Object . keys ( data ) . forEach ( dataKey => {
269
269
if ( transformsBase . indexOf ( dataKey ) >= 0 ) {
@@ -309,10 +309,15 @@ class QueueAnim extends React.Component {
309
309
}
310
310
const duration = transformArguments ( this . props . duration , key , i ) [ 0 ] ;
311
311
velocity ( node , 'stop' ) ;
312
- const data = this . getInitAnimType ( node , this . getVelocityEnterConfig ( key , i ) ) ;
312
+ const data = this . props . enterForcedRePlay ? this . getVelocityEnterConfig ( key , i ) :
313
+ this . getInitAnimType ( node , this . getVelocityEnterConfig ( key , i ) ) ;
314
+ if ( this . props . enterForcedRePlay ) {
315
+ node . style . visibility = 'hidden' ;
316
+ }
313
317
velocity ( node , data , {
314
318
duration,
315
319
easing : this . getVelocityEasing ( key , i ) [ 0 ] ,
320
+ visibility : 'visible' ,
316
321
begin : this . enterBegin . bind ( this , key ) ,
317
322
complete : this . enterComplete . bind ( this , key ) ,
318
323
} ) ;
@@ -441,6 +446,7 @@ QueueAnim.propTypes = {
441
446
animConfig : funcOrObjectOrArray ,
442
447
ease : funcOrStringOrArray ,
443
448
leaveReverse : React . PropTypes . bool ,
449
+ enterForcedRePlay : React . PropTypes . bool ,
444
450
animatingClassName : React . PropTypes . array ,
445
451
} ;
446
452
0 commit comments