AnimateActivity is an animated version of React's Activity component. It allows you to add exit animations when hiding elements.
Whereas AnimatePresence animates elements when they're added and removed from the tree, AnimateActivity uses the Activity component to show and hide the children with display: none, maintaining their internal state.
AnimateActivity shares the same API as Activity. By switching the mode prop from "visible" to "hidden", its child element will be hidden with display: noneafter child exit animations have completed.
By default, exiting children will maintain their default styles in the DOM. This means that if they're position: static or in some way affecting the layout of the elements around them, they continue to do so until the exit animation is complete.
We can change this by setting layoutMode to "pop". This will immediately pop the element out of its layout, allowing surrounding elements to reflow while it exits.
Unlock the full vault of 330+ Motion examples, 100+ tutorials, premium APIs, private Discord and GitHub, and powerful Motion Studio animation editing tools for your IDE.