Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add callback after animation #5

Closed
wants to merge 1 commit into from
Closed

Add callback after animation #5

wants to merge 1 commit into from

Conversation

lucas-aragno
Copy link

hey @bySabi !

I needed to run a callback after the animation on my project and I think that'd be a cool funcionality for the library let me know what you think!

@bySabi
Copy link
Collaborator

bySabi commented Nov 1, 2016

Hi @lucas-aragno, thanks for the PR, any contributing is welcome.

I really open to extend this component. I guest you need update some states when scroll happends. But your PR make two things that I prefer avoid if we have a better solution, opinionated here. One is the need to add a new prop and the other is fact that callback after is the half of use case, what happends with before animation
What you think is we extend animate prop API with: beforeHook and afterHook callbacks?
Your use case will be, for Ex:

<Scrollchor to="#aboutus" animate={{afterHook: (event) => updateState()}} className="nav-link">Home</Scrollchor>

@bySabi
Copy link
Collaborator

bySabi commented Nov 1, 2016

I push beforeHook and afterHook on master, currently unpublished.
Let me see what you think ...

I don´t sure is more "semantic" correct put callbacks on animate object or create separate props like, maybe: onBeforeAnimate , onAfterAnimate or what ever ...

@lucas-aragno
Copy link
Author

hey @bySabi sorry for the late response, have been really busy this couple of weeks. I think those hooks are exactly what I need 😄 , Thank you. I'll close this issue now

@bySabi
Copy link
Collaborator

bySabi commented Nov 6, 2016

@lucas-aragno at the I add two new props... beforeAnimate and afterAnimate callbacks ...
It is already published on 2.2.0 , tell me if it´s right for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants