Skip to content

Commit 137019c

Browse files
committed
fix group anim queue
1 parent 0aeda2c commit 137019c

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/TweenOneGroup.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ const TweenOneGroup: TweenOneGroupRef = React.forwardRef<any, IGroupProps>((prop
179179
};
180180
useLayoutEffect(() => {
181181
if (oneEnter.current) {
182-
const nextChild = toArrayChildren(props.children);
182+
const nextChild = toArrayChildren(props.children).filter((c) => c);
183183
const currentChild = toArrayChildren(currentChildren.current);
184184
// 不计入正在进场的元素又进场;
185185
const newNextChild = nextChild.filter(
@@ -191,11 +191,13 @@ const TweenOneGroup: TweenOneGroupRef = React.forwardRef<any, IGroupProps>((prop
191191
),
192192
);
193193
// 如果还在动画,暂存动画队列里,等前一次动画结束后再启动最后次的更新动画
194-
if (Object.keys(isTween.current).length && !exclusive) {
195-
// animQueue.current.push(nextChild);
196-
if (nextChild.length && newNextChild.length) {
197-
animQueue.current.push(newNextChild);
198-
}
194+
if (
195+
Object.keys(isTween.current).length &&
196+
!exclusive &&
197+
nextChild.length &&
198+
newNextChild.length
199+
) {
200+
animQueue.current.push(newNextChild);
199201
} else {
200202
setChild(changeChildren(nextChild, currentChild));
201203
}

0 commit comments

Comments
 (0)