You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I’m working on a project where I have a deeply nested component that needs to run an initial animation. However, I was surprised to find out that the animation didn’t trigger. After some investigation, I realized it was due to a top-level AnimatePresence having initial={false}.
It took me quite some time to figure out that the issue was coming from a top-level component. I’m wondering if anyone else has faced this issue and what approaches you've used to handle it. Is there a recommended way to ensure that deeply nested components still run their initial animations while keeping initial={false} at the top level?
Any tips or suggestions would be appreciated!
Here are some examples:
// Animations are disabled for both components exportfunctionInnerComponent(){return(<div><m.divanimate={{height: 100}}className="border border-blue-500 text-2xl">
Inner
</m.div></div>);}exportfunctionApp(){return(<AnimatePresenceinitial={false}><m.divanimate={{height: 300}}className="border border-red-500 text-2xl">
Test
<InnerComponent/></m.div></AnimatePresence>)}
// Workaround - wrap the InnerComponent within a separate AnimatePresenceexportfunctionApp(){return(<AnimatePresenceinitial={false}><m.divanimate={{height: 300}}className="border border-red-500 text-2xl">
Test
<AnimatePresence><InnerComponent/></AnimatePresence></m.div></AnimatePresence>)}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi all,
I’m working on a project where I have a deeply nested component that needs to run an initial animation. However, I was surprised to find out that the animation didn’t trigger. After some investigation, I realized it was due to a top-level
AnimatePresence
havinginitial={false}
.It took me quite some time to figure out that the issue was coming from a top-level component. I’m wondering if anyone else has faced this issue and what approaches you've used to handle it. Is there a recommended way to ensure that deeply nested components still run their initial animations while keeping
initial={false}
at the top level?Any tips or suggestions would be appreciated!
Here are some examples:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions