react-scroll-to-component icon indicating copy to clipboard operation
react-scroll-to-component copied to clipboard

Add callback function after scroll is ended

Open romanlex opened this issue 8 years ago • 4 comments

Example focus on input after scrolling

romanlex avatar Jun 22 '17 21:06 romanlex

maybe specifying a duration and using a setTimeout function is good enough

ghost avatar Nov 12 '17 19:11 ghost

A callback has a lot of use cases indeed. I would say any animation library should expose a life cycle methods eg: before-animation after-animation etc.. but a callback for a done animation is a great start.

sag1v avatar Apr 25 '18 11:04 sag1v

@flyingant I've noticed that react-scroll-to-component uses scroll-to behind the scenes.
scroll-to uses tween.js, and i came across this comment. So i guess this is "doable" 😃 All we need to do is:

const cb = scrollToComponent(this.ref);
cb.on('end', () => console.log('animation is done!'));

sag1v avatar Apr 25 '18 11:04 sag1v

@sag1v Yes, of course. it's native supported. I will put some examples to the demo.

flyingant avatar Apr 25 '18 13:04 flyingant