@@ -87,9 +87,10 @@ class QueueAnim extends React.Component {
8787 }
8888
8989 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 ) {
9394 /**
9495 * 多次刷新空子级处理
9596 * 如果 state.children 里还有元素,元素还在动画,当前子级设回 state.children;
@@ -104,14 +105,16 @@ class QueueAnim extends React.Component {
104105 const childrenShow = ! newChildren . length ? { } : this . state . childrenShow ;
105106 this . keysToEnterPaused = { } ;
106107 // 在出场没结束时,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+ }
115118
116119 this . keysToEnter = [ ] ;
117120 this . keysToLeave = [ ] ;
@@ -295,6 +298,7 @@ class QueueAnim extends React.Component {
295298 }
296299 }
297300 const paused = this . keysToEnterPaused [ key ] && ! this . keysToLeave . indexOf ( key ) >= 0 ;
301+
298302 animation = paused ? null : animation ;
299303 const isFunc = typeof child . type === 'function' ;
300304 const forcedJudg = isFunc ? { } : null ;
0 commit comments