question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] layout prop breaks MotionValue

See original GitHub issue

If 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

  1. Use official Motion Value Example Sandbox withlayout prop added to the box element (link above)
  2. Drag element left and right
  3. 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:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
bakoushincommented, Sep 10, 2020

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 start exit 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 since layout detaches MotionValue from the element, it’s no longer an option.

Maybe there are other ways to achieve this?

0reactions
mattgperrycommented, Nov 2, 2021

This has been solved in the meantime

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found