motiondivision / motiondivision/motion

[BUG] AnimatePresence doesn't start enter animation for new element

Open
#2,234 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
33.7k
Forks
1.4k
Avg merge
1d 10h
Merged PRs (30d)
14

Description

1. Read the FAQs 👇

2. Describe the bug
When using AnimatePresence, the old component unmounts, but the new one never moves out of the transition state, it keeps its opacity of 0. After editing and react performing a hot reload, for some reason the content appears as it should.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://stackblitz.com/edit/vite-react-ts-et84nk?file=src%2FOnboarding.tsx

This is a stackblitz sandbox of the issue being reproducable.
4. Steps to reproduce

Steps to reproduce the behavior:

  1. Go to the stackblitz sandbox
  2. Click on the right button (start onboarding)

5. Expected behavior

You should now see the old content ("Welcome to my company....") transition away to the left and the new content ("Hello world") should transition in from the right

6. Video or screenshots

If applicable, add a video or screenshots to help explain the bug.

7. Environment details
MacOS Ventura 13.4, Brave 1.52.130
If applicable, let us know which OS, browser, browser version etc you're using.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked StackBlitz reproduction and inspect src/Onboarding.tsx, then trace how AnimatePresence handles the old and new content when the right button is clicked. Confirm the fix by reproducing the transition so the old content exits left and the new content enters from the right instead of remaining at opacity 0.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.