-
-
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
[bug]: Spring Config function not called when using Imperative API #2186
Comments
I revisited the issue and found a way to make the config work—the config must be set via a animation.start({
to: { opacity: 1, scaleX: 1, scaleY: 1 },
config: springConfig
}); By the way, setting the config via a animation.set({ config: springConfig }); // not working Furthermore, looking more into the comparison of Imperative API v.s. stateful component example, I noticed that the Going back to my code, inspecting it, I realized that if I used const [springs, animation] = useSpring(() => ({
from: { opacity: 0.2, scaleX: 0.2, scaleY: 0.2 },
config: springConfig
})); and called |
Same here. I am really confused that |
Which react-spring target are you using?
@react-spring/web
@react-spring/three
@react-spring/native
@react-spring/konva
@react-spring/zdog
What version of react-spring are you using?
9.7.3
What's Wrong?
I'd like to use the Imperative API (https://react-spring.dev/docs/concepts/imperative-api) with a Spring Config function (https://react-spring.dev/docs/advanced/config#config-per-springvalue) to customize friction, tension, etc per SpringValue, like this:
but the config function is never called (example: https://codesandbox.io/s/react-spring-bug-277lrl?file=/App.js).
To Reproduce
With this minimal snippet:
Or see this codesandbox: https://codesandbox.io/s/react-spring-bug-277lrl?file=/App.js
Expected Behaviour
Spring Config function should be called when using the Imperative API.
Link to repo
https://codesandbox.io/s/react-spring-bug-277lrl?file=/App.js
The text was updated successfully, but these errors were encountered: