[bug]: Shorthands don't merge with transform values
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.4.5
What's Wrong?
(You probably know this one already, so please ignore if it is on a to-do list already.)
If I want to go from one transform value to another, with the library, I can't use shorthands in the to value, if I am starting off with a from value (which cannot have shorthands).
So the only way you can really go if you have a from transform string is to another transform string.
Is this by design? Not sure this is a bug. But since I spent a bunch of time learning this lesson, thought I'd share it.
To Reproduce
import { useSpring } from 'react-spring'
const [props, api] = useSpring(() => {
from: { transform: 'scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0)' }
to: { scale3d: '0.475 0.475 0.475' }
})
return <animated.div style={{props}} />
Expected Behaviour
For the shorthands to merge with the initial transform value in coming up with a final value.
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
Reproduce the example with @react-spring/web and useSpring, starting with a from transform string and a to shorthand. Trace how transform values and shorthands are parsed and combined. Done means the shorthand is merged with the initial transform value, with coverage for this reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100