Tell when animation is finished
See original GitHub issueSort of related to #100
It is OK now to check current value if you are using default spring preset. But if I am using something like wobbly
and animate height
, I can easily get zero height while animation is far from being finished (then it goes to negative height, but that is a different story).
So if I think that my animation is done when height equals 0 and want to unmount element, that is not actually true and on next RAF component is shown again but with a very little height. And again and again.
I am pretty sure we had this discussion somewhere else, but could not find a separate issue for this.
I would like to see API in this way:
<Motion>
{(style, {isFinished}) => console.log(isFinished)}
</Motion>
Passing another object to render
function will not break current API, and will potentially allow us to pass more fields, not only isFinished
but exposing some RM internal state (maybe related to #219)
Issue Analytics
- State:
- Created 8 years ago
- Comments:26 (10 by maintainers)
@chenglou any news on when/if this will be implemented in
TransitionMotion
? I think that would keep consistency in the API and allow to have an easy, clean way to use that functionality (all I tried to use this with current implementation feels hacky).Not sure if this is the proper way to make a formal request, but I think this could be pushed forward. Any thoughts?
Thanks!
Alright so end callback is in for
Motion
(react-motion v0.4.3). If there’s request for such cb forStaggeredMotion
andTransitionMotion
we should reopen this issue or create a new one.Sorry for the wait everyone! And thank you again @appsforartists for actually implementing it =].