@@ -87,9 +87,10 @@ class QueueAnim extends React.Component {
87
87
}
88
88
89
89
componentWillReceiveProps ( nextProps ) {
90
- const nextChildren = toArrayChildren ( nextProps . children ) ;
91
- let currentChildren = this . originalChildren ;
92
- if ( ! nextChildren . length && ! currentChildren . length && this . state . children . length ) {
90
+ const nextChildren = toArrayChildren ( nextProps . children ) . filter ( item => item ) ;
91
+ let currentChildren = this . originalChildren . filter ( item => item ) ;
92
+ const emptyBool = ! nextChildren . length && ! currentChildren . length && this . state . children . length ;
93
+ if ( emptyBool ) {
93
94
/**
94
95
* 多次刷新空子级处理
95
96
* 如果 state.children 里还有元素,元素还在动画,当前子级设回 state.children;
@@ -104,14 +105,16 @@ class QueueAnim extends React.Component {
104
105
const childrenShow = ! newChildren . length ? { } : this . state . childrenShow ;
105
106
this . keysToEnterPaused = { } ;
106
107
// 在出场没结束时,childrenShow 里的值将不会清除。再触发进场时, childrenShow 里的值是保留着的, 设置了 enterForcedRePlay 将重新播放进场。
107
- this . keysToLeave . forEach ( key => {
108
- // 将所有在出场里的停止掉。避免间隔性出现
109
- this . keysToEnterPaused [ key ] = true ;
110
- if ( nextProps . enterForcedRePlay ) {
111
- // 清掉所有出场的。
112
- delete childrenShow [ key ] ;
113
- }
114
- } ) ;
108
+ if ( ! emptyBool ) { // 空子级状态下刷新不做处理
109
+ this . keysToLeave . forEach ( key => {
110
+ // 将所有在出场里的停止掉。避免间隔性出现
111
+ this . keysToEnterPaused [ key ] = true ;
112
+ if ( nextProps . enterForcedRePlay ) {
113
+ // 清掉所有出场的。
114
+ delete childrenShow [ key ] ;
115
+ }
116
+ } ) ;
117
+ }
115
118
116
119
this . keysToEnter = [ ] ;
117
120
this . keysToLeave = [ ] ;
@@ -295,6 +298,7 @@ class QueueAnim extends React.Component {
295
298
}
296
299
}
297
300
const paused = this . keysToEnterPaused [ key ] && ! this . keysToLeave . indexOf ( key ) >= 0 ;
301
+
298
302
animation = paused ? null : animation ;
299
303
const isFunc = typeof child . type === 'function' ;
300
304
const forcedJudg = isFunc ? { } : null ;
0 commit comments