Framer Motion example skips exit animations
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
Which project does this relate to?
Router
Describe the bug
Hello! Loving the library so far! 😄
I was trying some of the examples and it seems that Framer Motion exit animations are not playing on the with-framer-motion example. Next.js has this problem as well. One of the workarounds found by the community is this one. I was wondering if the issue in Router could be solved by doing something similar 🤔
Maybe transitioning between pages with AnimatePresence is not worth the hassle? In Next.js there's also this library which intercepts navigations by using a custom Link component and useRouter hook. It plays an animation before commiting the navigation. This method doesn't work when using the browser's back and forwards buttons tho, but maybe that's more of a Next.js limitation
Your Example Website or App
Steps to Reproduce the Bug or Issue
- From the index route, click on the about link
- Observe how the index component instantly unmounts, without playing the exit animation
Expected behavior
It should unmount after playing the exit animation
Screenshots or Videos
https://github.com/user-attachments/assets/d545fca8-e418-4f04-923a-1d6eccbcb077
Platform
N/A
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the with-framer-motion example at examples/react/with-framer-motion/src/main.tsx and reproduce the transition from the index route to the about route. Trace how navigation unmounts the index component and compare the issue's linked Next.js workaround. Done means the exit animation plays before the component unmounts when changing routes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100