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.div style={{X} does not project after changes or call x.Set(value)

See original GitHub issue

2. Describe the bug motion.div style={{x}} does not gets updated in new version after x change… Works only in version <=2.3 (2.3.1rc2)

I have toggle example motion div and after state change or calling x.Set("value") the position is not updated over style={{x}}. The x value itself is changed but motion.div keeps the last state and do not update this change…

     <motion.div
            style={{
              x: x,
            }}
            drag="x"
            dragConstraints={{ left: 0, right: 0 }}
            onDragEnd={(e, position) => {
              if (Math.abs(position.offset.x) / 2 > 20 / 2) {
                if (position.offset.x > 0) {
                  setstate(true);
                  x.set(20);
                } else {
                  setstate(false);
                  x.set(0);
                }
              }
            }}
            dragElastic={0.5}
     />

Give a clear and concise description of what the bug is.

LastVersion (Not working - BUG) https://codesandbox.io/s/framer-toggle-test-forked-7pp44?file=/src/Example.tsx:355-479

Working ( v <= v2.3) https://codesandbox.io/s/framer-toggle-test-forked-0ll9i?file=/src/Example.tsx

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
georgekraxcommented, Feb 7, 2021

I am facing similar issues with versions >= 3.0.0. In my case the useAnimation() hook does not work at all for x and y values.

It maybe is my mistake and the code is not working, but this library is considered production-ready, and in my opinion, that kind of issues should be fixed, and answers should be given in the comments section.

1reaction
mattgperrycommented, Feb 7, 2021

@georgekrax This issue was opened three days ago, two of which have been the weekend. About a version that’s been out for over a month now. I’ll be looking at this ticket at some point in the coming weeks but it will be prioritised alongside other bugs and product features.

In the meantime we also accept PRs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How can I fix my Framer Motion animation in React?
It is working with this library. I do not know if changing libraries an option for you in this project. You can define...
Read more >
Framer-Motion: New And Underestimated Features - Shakuro
Framer-motion library helps you create advanced React animations with ... Values in animate can not only take single values (check out the ...
Read more >
How To Use Framer Motion With React, TypeScript and Styled ...
It can be passed as an attribute inside the animate property or as a separate transition property. If no transition will be set...
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 tutorial: How to easily create React animations
Framer Motion has a clean, simple API that doesn't bloat components. ... <motion.div animate={{ x: '100px' }} > Weeee I'm animated ...
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