-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
api.set does not work for useSprings hook #1725
Comments
Not sure if the abstinence of ex. |
@alexwidua I have the same issue... unfortunately if I use Would be great if some one could implement the missing piece of the api |
I have the exact same problem. |
Any news on this? I'm having the same problem. |
Is the issue here that the api returned from |
Yes! |
Okay well this is an enhancement to the current |
I think I fixed it in the pull request I just made. |
Just encounted the same issue, |
Intro
When doing animations, we sometimes have the need to set a value without animating it. An example is when showing a tooltip when hovering over a certain area of the screen; as long as the mouse is in this area, we want to animate the positional changes of the tooltip but if we move out of the area from the left, and then enter the area from the right, we want to position the tooltip at the place of entrance immediately, while at the same time setting it to be visible. I was happy to find the complementary
api.set
andapi.start
for these occasions.🐛 Bug Report
The above behaviour works great for
useSpring
, but not foruseSprings
. On https://react-spring.io/hooks/use-springs there is the following example:where you think it's possible to use the api returned by
useSprings
to make individual changes to the returned springs. This is also the case, but only for theapi.start
method, not for theapi.set
method. As I do the same for set:the editor complains and the expected effect does not happen. The same kind of change works great with
useSpring
.To Reproduce
Check https://codesandbox.io/s/react-spring-usesprings-bug-z2hic and follow the instructions there
Steps to reproduce the behavior:
Simply use
useSprings
and try to runapi.set
for individual springs on its returned api and the set effect will not take place.Expected behavior
I expect the behaviour of
useSpring
to be the exact same inuseSprings
but generalized over multiple springs. I also expect theapi.start
method ofuseSprings
to be similar toapi.set
which it does not appear to be.All in all, this means that I expect
api.set
to work and that it should have the same effect asapi.start
but without an animation, but instead an immediate resulting effect.Link to repro (highly encouraged)
https://codesandbox.io/s/react-spring-usesprings-bug-z2hic
Environment
react-spring
v9.3.0react
v17.0.2Thanks for a GREAT library! 🌹
The text was updated successfully, but these errors were encountered: