react-spring
react-spring copied to clipboard
[bug]: Imperative .start() doesn't account for delay
Which react-spring target are you using?
- [X]
@react-spring/web
- [ ]
@react-spring/three
- [ ]
@react-spring/native
- [ ]
@react-spring/konva
- [ ]
@react-spring/zdog
What version of react-spring are you using?
9.0.0
What's Wrong?
I have a spring which should be delay
ed when called through the imperative .start()
. But it seems like the delay
value gets ignored. Is this expected? Is this by design?
To Reproduce
const [springProps, animate] = useSpring(() => ({
from: { opacity: 0 },
to: { opacity: 1 },
delay: 5000
})
// Bunch of code later
animate.start()
Expected Behaviour
When .start()
is called, a delay happens before the animation triggers.
Link to repo
Hey, does this still happen with the latest version?
Also, please provide a codesandbox repro of the issue you're facing.
Haven't tried with the latest version, Joshua. Will make a codesandbox for it.
Still happens with the latest version.
Code sandbox is here: https://codesandbox.io/s/amazing-moon-kf0wop?file=/src/App.js
This might not be a bug. I may have misunderstood .start()
. I thought it preserved the original props (not just from
and to
, but also things like delay
and config
), and merged in new props. But it seems like it will only work when I re-introduce the delay
prop value in the mergeable object.