I might misunderstand this whole thing, but I'm trying to do some css animations using React and React Transition Group.
But as for my code below, the exit animations
wont get triggered for the nested (last) CSSTransition component. Is it not possible to work with React Transition Group like this?
I hope this code is enough to show how it is structured:
return(
<TransitionGroup component={null}>
{active &&
<CSSTransition in={active} timeout={time} classNames={overlayAnimationStyles}>
<div className={styles.video}>
<div className={styles.video__overlay} onClick={handleCloseClick}/>
<CSSTransition appear in={active} timeout={time} classNames={contentAnimationStyles} onEntered={handlePlayerEntered}>
<div className={styles.video__content}>
<div className={styles.video__player}>
{embedPlayer && <iframe
src={`https://www.youtube.com/embed/${video}`}
frameBorder="0" allowFullScreen></iframe>}
</div>
</div>
</CSSTransition>
</div>
</CSSTransition>
}
</TransitionGroup>
);
The different styles objects look like this:
const overlayAnimationStyles = {
exit: videoAnimationStyles['overlay-exit'],
exitActive: videoAnimationStyles['overlay-exit-active'],
enter: videoAnimationStyles['overlay-enter'],
enterActive: videoAnimationStyles['overlay-enter-active'],
};
const contentAnimationStyles = {
appear: videoAnimationStyles['content-appear'],
appearActive: videoAnimationStyles['content-appear-active'],
exit: videoAnimationStyles['content-exit'],
exitActive: videoAnimationStyles['content-exit-active']
};
Much appreciated. If I need to provide an example, let me know.