MY goal is very simple, When the component is loaded, I want:
- A div to grow
- The text in that div fades in
A growing div is easy
<CSSTransition
in={onLoad}
timeout={300}
classNames="grow"
unmountOnExit
>
<div className={"success-container"}></>
</CSSTransition>
with the CSS
.success-container {
background: lightblue;
width: 400px;
height: 100px;
transition: height 200ms, width 200ms;
}
.grow-enter {
height: 50px;
width: 100px;
}
fade-in is also very easy
<CSSTransition
in={onLoad}
timeout={300}
classNames="fade"
unmountOnExit
>
<div className={"text-container"}>Here is some fading Text</>
</CSSTransition>
with the CSS
.text-container {
width: 100%;
height: 100%;
transition: opacity 200ms;
}
.fade-enter {
opacity: 0;
}
Now When I place the Second Transition inside the first, the fade-in no longer happens and I have no idea how to proceed
Here is a minimum example I made in Code Sandbox
https://codesandbox.io/s/wonderful-fermi-gsz11?file=/src/styles.css
Is there a way to make this work? or another way to get the same effect (preferably without extra dependencies)?