onStart called after first animation tick #1996
-
Hey there. It took me some time to figure out that What is the preferred way of setting global state before the animation starts and for subsequent transition starts? It also got me thinking that it could be nice with a Cheers. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Sorry to hear it took you a while to figure this out, it is documented (albeit rather small) in the current docs here – https://react-spring.dev/common/props#events-as-functions, I've made this more prevalent in the new docs here – https://beta.react-spring.dev/docs/advanced/events#onstart It really depends on how you're starting your animation. Realistically I don't think it's something we're going to add I would look at using an |
Beta Was this translation helpful? Give feedback.
Hi @Jacobjepsen27
Sorry to hear it took you a while to figure this out, it is documented (albeit rather small) in the current docs here – https://react-spring.dev/common/props#events-as-functions, I've made this more prevalent in the new docs here – https://beta.react-spring.dev/docs/advanced/events#onstart
It really depends on how you're starting your animation. Realistically I don't think it's something we're going to add I would look at using an
effect
if your animation is trigger by an update of theitem
argument otherwise if you're using theimperative api
then you can flag this at the same time you call theapi
.