chenglou / react-motion

A spring that solves your animation problems.
MIT License
21.68k stars 1.16k forks source link

didEnter #422

Open klimashkin opened 7 years ago

klimashkin commented 7 years ago

Would be great to have didEnter on <TransitionMotion>. For instance if user hovers menu element to show submenu (with transition), do not react on click on this hovered element until entering transition is done, to prevent accidental submenu closing (click works with hover to toggle menu dropdown and for touch devices)

souporserious commented 7 years ago

Although it's not baked in you can achieve this with something similar to what the UI pack does here then just check once your current value reaches its destination. I know that @chenglou wanted to keep the API small and light so not sure if this feature is on the roadmap.

klimashkin commented 7 years ago

@souporserious onEnter in react-motion-ui-pack is a callback when animation starts, in the same moment as willEnter.

didLeave was added in last release, would be logical to add didEnter as well

souporserious commented 7 years ago

Definitely, I'm sure a PR would be welcome then 😀

ollwenjones commented 6 years ago

not 100% similar, because it's whenever either enter or leave animations are triggered, but it could be used to the same effect: PR for adding onRest to TransitionMotion #552