[Refactoring] Transition: Small refactoring

This commit is contained in:
Alexander Zinchuk 2021-12-04 13:44:17 +01:00
parent 8015a7360e
commit e281dd93b5

View File

@ -133,10 +133,7 @@ const Transition: FC<OwnProps> = ({
} }
}); });
let dispatchHeavyAnimationStop: NoneToVoidFunction; const dispatchHeavyAnimationStop = dispatchHeavyAnimationEvent();
if (animationLevel > 0) {
dispatchHeavyAnimationStop = dispatchHeavyAnimationEvent();
}
requestAnimationFrame(() => { requestAnimationFrame(() => {
container.classList.add('animating'); container.classList.add('animating');
@ -169,9 +166,7 @@ const Transition: FC<OwnProps> = ({
} }
} }
if (dispatchHeavyAnimationStop) { dispatchHeavyAnimationStop();
dispatchHeavyAnimationStop();
}
cleanup(); cleanup();
@ -189,7 +184,7 @@ const Transition: FC<OwnProps> = ({
currentKeyRef.current = activeKey; currentKeyRef.current = activeKey;
if (animationLevel > 0 && watchedNode) { if (watchedNode) {
waitForAnimationEnd(watchedNode, onAnimationEnd); waitForAnimationEnd(watchedNode, onAnimationEnd);
} else { } else {
onAnimationEnd(); onAnimationEnd();