Transition: Fix exception when missing node

This commit is contained in:
Alexander Zinchuk 2021-08-06 03:25:21 +03:00
parent 71c067e751
commit 18fa93365c

View File

@ -140,6 +140,10 @@ const Transition: FC<OwnProps> = ({
requestAnimationFrame(() => {
container.classList.add('animating');
if (onStart) {
onStart();
}
function onAnimationEnd() {
requestAnimationFrame(() => {
container.classList.remove('animating', 'backwards');
@ -172,16 +176,15 @@ const Transition: FC<OwnProps> = ({
});
}
if (animationLevel > 0) {
const toNode = name === 'mv-slide' ? childNodes[activeIndex].firstChild! : childNodes[activeIndex];
const toNode = name === 'mv-slide'
? childNodes[activeIndex] && childNodes[activeIndex].firstChild
: childNodes[activeIndex];
if (animationLevel > 0 && toNode) {
waitForAnimationEnd(toNode, onAnimationEnd);
} else {
onAnimationEnd();
}
if (onStart) {
onStart();
}
});
}, [
activeKey,