[BUG] layout prop breaks MotionValue
See original GitHub issueIf an element has a layout
prop, MotionValue
is not updated while dragging that element, so dependent elements don’t animate.
CodeSandbox with reproduction – based on the official Motion Value Example Sandbox
Steps to reproduce
- Use official Motion Value Example Sandbox with
layout
prop added to thebox
element (link above) - Drag element left and right
- Notice that the background doesn’t animate, nor does the icon inside the box.
Expected behavior
Adding layout
prop doesn’t break MotionValue
behavior.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6
Top Results From Across the Web
Error importing Framer Motion v5 in React (with create-react ...
I downgraded the Framer motion version to "4.1.17" by changing the package.json file and running npm install and it works for me.
Read more >Smooth Layout Transitions with Framer Motion and Gatsby
Check out the tutorial and become more creative!Buy the Source Code Link https://bit.ly/3r51m0lJust fork to have the starter project ...
Read more >Everything about Framer Motion layout animations
A complete guide to Framer Motion layout animations showcasing every concept, from the layout prop, shared layout animations and LayoutGroup ...
Read more >framer-motion | Yarn - Package Manager
Fixed bug relative layout animations within rotated layers. Fixed bug with layout="preserve-aspect" where layers that do change size but aren't moved are ...
Read more >Table of contents - The Framer book
CSS style properties · Framer Motion animation properties ... Design components inside virtual folders ... Displaying a Motion value's current value.
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
Another issue with detached
MotionValue
.Can we stop layout animation at any given point of time like we could with
MotionValue.stop()
?For example: I want to achieve a “swipe-to-remove” animation in a list of items.
In this CodeSanbox example (based on official Notifications Demo) each notification could be removed from the stack by dragging to the left.
Notice, that before starting an
exit
animation, a box first bounces back near to its initial position. Is there a way to stop it from bouncing back and just startexit
animation from where the drag gesture ended?Metaphorically speaking, how can we cut the invisible spring holding it? It is achievable using
MotionValue.stop()
, but sincelayout
detachesMotionValue
from the element, it’s no longer an option.Maybe there are other ways to achieve this?
This has been solved in the meantime