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] Motion elements does not follow parent component when dragged after react state update.

See original GitHub issue

Describe the bug When dragging a motion.ul element i expect the children motion.li to also be dragged along. This works fine directly after mount, but as soon as we update the state of the component, the list elements becomes static.

I first suspected it was just something I’m missing in the new API, so I wrote a question on Stack Overflow. But after simplifying it further, and comparing with version 1.11.1, I now suspect this is a bug.

IMPORTANT: Provide a CodeSandbox reproduction of the bug https://codesandbox.io/s/framer-motion-reorder-animation-go6tb

Steps to reproduce

Steps to reproduce the behavior:

  1. Drag the yellow background => Colored boxes follows the drag motion
  2. Click on “Shuffle”
  3. Drag the yellow background => Colored boxes do not move.

Expected behavior I expect the colored boxes to behave the same before and after the shuffle. This worked in version 1.11.1 (only code difference is using positionTransition instead of layout prop): drag-motion-1 11 1

Video or screenshots drag-motion-2 0 1

Environment details Windows 10 Chrome Version 83.0.4103.116

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

3reactions
mattgperrycommented, Jul 17, 2020

After a render layout projection has been enabled so elements are trying to project themselves to a specific place on the viewport.

At some point soonish I want to look into resolving these bounding boxes relatively to parents so I imagine this will fix that.

0reactions
rijkcommented, Nov 15, 2020

Temporarily overriding with transform: none !important worked as a workaround during animations, but I’m now running into the dragging issue as well.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Child components are not dragged with parent after react state ...
It should be possible to reorder the lists (horizontally) and the tasks within a list (vertically) by dragging the elements. I am facing...
Read more >
Reconciliation - React
When a component updates, the instance stays the same, so that state is maintained across renders. React updates the props of the underlying...
Read more >
React Draggable Components: A Complete Guide - Copycat
React -Draggable is a library that simplifies adding dragging movement to React components and elements without incidents.
Read more >
How to implement drag and drop in React with React DnD
To update the local state, we need to know the dragged element and the hovered element, which is the element on which the...
Read more >
react-draggable - npm
It does not create a wrapper element in the DOM. Draggable items are moved using CSS Transforms. This allows items to be dragged...
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