[BUG] positionTransition animation delayed when children exit
See original GitHub issueDescribe the bug
When AnimatePresence
children unmount, the exit animation happens to completion before positionTransition animations take place. When new children mount, no such delay exists.
To Reproduce Steps to reproduce the behavior:
- Create basic example with
AnimatePresence
parent and<motion.*>
children.
<AnimatePresence>
<motion.div />
<motion.div />
</AnimatePresence>
- Add animation props to
<motion.div>
children
<motion.div
animate={{ opacity: 1 }}
initial={{ opacity: 0 }}
exit={{ opacity: 0 }}
key={uniqueKey}
positionTransition
/>
- Create a way to add/remove
<motion.div>
children.
<button onClick={handleAdd}>Add Child</button>
<AnimatePresence>
<motion.div onClick={handleRemove} {...} />
</AnimatePresence>
- Observe that when adding a child, all animations (opacity and position) happen simultaneous, but when removing a child, opacity/exit transitions happen first, and then position animations.
See example: https://codesandbox.io/s/framer-motion-reorder-animation-rlojg
Expected behavior All animations happen simultaneously unless otherwise specified via delay prop, etc.
Desktop (please complete the following information):
- OS: Mac
- Browser: Chrome
- Version 75.0.3770.142
Issue Analytics
- State:
- Created 4 years ago
- Comments:8
Top Results From Across the Web
PositionedTransition class - widgets library - Dart API
Animated version of Positioned which takes a specific Animation<RelativeRect> to transition the child's position from a start position to an end position ...
Read more >Exit Animation For Children Items Not Working In Framer Motion
Describe the bug When AnimatePresence children unmount, the exit animation happens to completion before positionTransition animations take place. import React ...
Read more >Unity 5: How to fix delayed animator/animation issue! - YouTube
This short guide shows you how to get rid of unwanted delay when using the animator and triggers in Unity 5!
Read more >framer-motion | Yarn - Package Manager
A simple and powerful React animation library ... [8.0.2] 2022-12-23. Fixed. Fixing defaults for hardware-accelerated animations.
Read more >https://raw.githubusercontent.com/framer/motion/ma...
[7.5.4] 2022-10-17 ### Fixed - Fixed bug relative layout animations within ... `layout` elements to animate to their new layout as soon as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m gonna look into this as part of Framer Motion 2 and AnimateSharedLayout
@InventingWithMonster Just following up — I’ve updated to to 2.0 and notice this staggered exit/smooth entrance issue is still around. Is it something you’re still looking into, or is it fixed and I’m just not implementing it properly?