I started a project with next.js using framer motion and chakra UI. Transition and Hover animations are working. But the dom element disappears before the exit animation end. Here's my code snippets.
<AnimatePresence exitBeforeEnter>
{!isRecentStoryHovered && (
<motion.div key="modal" initial={{ opacity: 0 }} animate={{ opacity: 1 }} exit={{ opacity: 0 }} transition={{ duration: 2, ease: "easeInOut", when: "afterChildren" }}>
<Flex gap="2">
<Button borderRadius="full" w="10" h="10" variant="solid" padding="0">
<IconFileDots color="white" size="24" />
</Button>
<Button borderRadius="full" w="10" h="10" variant="solid" padding="0">
<IconMessageCircle2 color="white" size="24" />
</Button>
</Flex>
</motion.div>
)}
</AnimatePresence>
I've imported the necessary things correctly.
import { motion, isValidMotionProp, AnimatePresence, useAnimationControls } from "framer-motion";
But dom disappear before the exit animation.
