Transition: Fix exception when missing node
This commit is contained in:
parent
71c067e751
commit
18fa93365c
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user