Which react-spring target are you using?
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:
const springConfig = (key) => {
if (key === "opacity")
return { tension: 60, friction: 10, precision: 0.0001 };
else if (key === "scaleX") return { tension: 58, friction: 4.3 };
else if (key === "scaleY") return { tension: 70, friction: 4 };
return {};
};
const animation = useSpringRef();
const springs = useSpring({
ref: animation,
from: { opacity: 0, scaleX: 0.96, scaleY: 0.96 },
config: springConfig
});
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:
const springConfig = (key) => {
if (key === "opacity")
return { tension: 60, friction: 10, precision: 0.0001 };
else if (key === "scaleX") return { tension: 58, friction: 4.3 };
else if (key === "scaleY") return { tension: 70, friction: 4 };
return {};
};
const animation = useSpringRef();
const springs = useSpring({
ref: animation,
from: { opacity: 0, scaleX: 0.96, scaleY: 0.96 },
config: springConfig
});
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
Which react-spring target are you using?
@react-spring/web@react-spring/three@react-spring/native@react-spring/konva@react-spring/zdogWhat 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