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

"onComplete" never gets called when user interrupts scroll animation #26

Closed
mciastek opened this issue Aug 22, 2019 · 5 comments
Closed

Comments

@mciastek
Copy link

mciastek commented Aug 22, 2019

When you set cancelOnUserAction to true and after scroll animation is interrupted by user's action, the onComplete never gets called. It would be nice to know if animated completed even if it was interrupted in the middle. I would like to help with PR, so just let me know if that's a good idea.

handleUserEvent = function() {
removeListeners();
cancelAnimationFrame(requestID);
};

@Stanko
Copy link
Owner

Stanko commented Aug 22, 2019

Hey @mciastek,

You are correct, it doesn't get called in that scenario. I thought about it for a while, and I think better solution would be to add a new property onUserCancelation (name is open for suggestion 🙈).

Honestly I never run into scenario where I needed that.

What do you think?

EDIT: It could be added here:
https://github.com/Stanko/animated-scroll-to/blob/master/animated-scroll-to.js#L140-L143

@mciastek
Copy link
Author

mciastek commented Sep 2, 2019

Hi @Stanko! Thanks for responding to my issue!

Honestly, I'm not sure if I need to know if scroll animation has been interrupted by user or not. I would prefer having only one callback which tells me that animation ended. Simple as that. If such information is required I would add an argument to onComplete callback, which tells you if animated has been ended before it's done. What do you think about it?

@Stanko
Copy link
Owner

Stanko commented Sep 2, 2019

It probably makes sense to have one callback, and pass a boolean argument to it canceled. I'll create a change soon.

@mciastek
Copy link
Author

mciastek commented Sep 2, 2019

Great! I'm happy to help with PR if needed.

@Stanko
Copy link
Owner

Stanko commented Sep 2, 2019

Published in v1.3.0 🎉 onComplete now receives a boolean argument isCanceledByUserAction

#27

@Stanko Stanko closed this as completed Sep 2, 2019
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

No branches or pull requests

2 participants