-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
onRest is called again after rerender #623
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
Comments
It's how onRest is currently working, it animates between 100% and 100% and comes to a rest immediately. If if didn't do that, then you couldn't await async animations, since onRest wouldn't be called once you animate towards a value that's already set. |
understood, thanks for the explanation. But how can i change the state once, after the animation has finished? onRest(to, from) {
if(to.width !== from.width) {
setState(i+1);
}
} |
This will be fixed by #615 |
You can use v9 like this now: Let us know how it goes: #642 |
Uh oh!
There was an error while loading. Please reload this page.
Problem: Once completed, onRest function is called on every rerender.
minimal codesandbox demo
Expected: the count should only increment once.
Current Behaviour: after rerender the onRest function is called again, and the count gets updated.
Versions in this demo:
"react-spring": "8.0.19",
"react": "16.8.3",
"react-dom": "16.8.3"
The text was updated successfully, but these errors were encountered: