[bug]: Different configs per property not possible in useTransition()
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 29.1k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
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.6.0
What's Wrong?
When using useTransition it does not seem to be possible to have different spring configs per property like stated in https://www.react-spring.dev/docs/advanced/config#config-per-springvalue .
To Reproduce
Consider this simple transition:
const transitions = useTransition(data, {
from: { opacity: 0, y: 2 },
enter: { opacity: 1, y: 0 },
leave: { opacity: 0, y: -2 },
config: (key) => {
return key === 'y' config.wobbly : { duration: 600 };
},
});
https://www.react-spring.dev/docs/advanced/config#config-per-springvalue states that a function-based config has access to the key of the animated property. In case of useTransition() the passed variable holds the value of data.
Expected Behaviour
We have access to the property key in function-based configs.
Link to repo
_
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the useTransition implementation and the config-per-springvalue documentation linked in the report, using the @react-spring/three target and the shown property-based configuration. Reproduce the transition with separate opacity and y settings, then verify that the configuration callback receives the animated property key and that both configurations take effect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, three.js, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100