Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Cannot mix controls and dragging #413

Closed
angry-dan opened this issue Dec 17, 2019 · 2 comments
Closed

[BUG] Cannot mix controls and dragging #413

angry-dan opened this issue Dec 17, 2019 · 2 comments
Labels
bug Something isn't working

Comments

@angry-dan
Copy link

angry-dan commented Dec 17, 2019

2. Describe the bug

I can no longer drag after using controls. This might be intentional, but I can't see anything in the docs about the relationship between controls and dragging. I came across the undocumented _dragTransitionControls, but I don't know how to use it.

3. IMPORTANT: Provide a CodeSandbox reproduction of the bug

https://codepen.io/angry-dan/pen/RwNoJMM

4. Steps to reproduce

Visit the Codepen above, note that you can drag the red box but only once. The onDragComplete starts an animation and after that point dragging is no longer possible.

5. Expected behavior

You drag the element, when you release it moves to the defined position, then you can continue to drag it.

Obviously in the case of this simple example I can use a drag constraint. What I'm trying to do though is to complete a swiping transition that the user makes. Similar to the example here: https://codesandbox.io/s/framer-motion-image-gallery-pqvx3, I want a user to swipe an element and then if that element is swiped far/fast enough have it transition to its final position. I tried with dragTransition and modifyTarget but they just created really weird behaviours.

@angry-dan angry-dan added the bug Something isn't working label Dec 17, 2019
@angry-dan angry-dan changed the title [BUG] [BUG] Cannot mix controls and dragging Dec 17, 2019
@angry-dan
Copy link
Author

So I just learnt something new about this bug, in that there's an incompatibility between drag and setting offset transforms. I'm not clear on exactly how or why, but the simplest way I can replicate it is here: https://codepen.io/angry-dan/pen/NWPwPQZ. Simply setting y with initial prevents the first drag operation from working.

I hadn't noticed it at first, but this example also suffers from the same bug: https://codesandbox.io/s/framer-motion-bottom-sheet-fixed-m2vls. I'm pretty sure that my first codepen link above and this second example are closely related.

@angry-dan
Copy link
Author

I did a bit more research into this, and found the root cause. I've opened a new issue here: #424 so closing this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant