[BUG] motion.div style={{X} does not project after changes or call x.Set(value)
See original GitHub issue2. 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:
- Created 3 years ago
- Comments:7
Top 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 >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
I am facing similar issues with versions >= 3.0.0. In my case the
useAnimation()
hook does not work at all forx
andy
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.
@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.