-
-
Notifications
You must be signed in to change notification settings - Fork 383
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
Dialog "enter" animation doesn't work since new animate API #643
Comments
Hey @Grsmto 👋, Thank you for opening an issue. We'll get back to you as soon as we can. If you use Reakit at work, you can also ask your company to sponsor us ❤️. |
Thanks for reporting it, @Grsmto! Do you know if it works on |
Seems to be working fine on |
I'm not sure what's happening, but maybe we will have to use double Possibly related to https://stackoverflow.com/questions/44145740/how-does-double-requestanimationframe-work I just don't know if we can cancel the nested animation frame in the effect cleanup callback. |
Right. I would have guess that code to be enough to "wait for the next render" before adding the But maybe this would do the trick?: React.useEffect(() => {
if (!options.animated) return undefined;
let raf;
window.setTimeout(() => {
raf = window.requestAnimationFrame(() => {
if (options.visible) {
setTransition("enter");
} else if (animating) {
setTransition("leave");
} else {
setTransition(null);
}
});
}, 0);
return () => window.cancelAnimationFrame(raf);
}, [options.animated, options.visible, animating]); I'm not sure I think this would be the exact same thing as the double RAF trick. |
🐛 Bug report
Current behavior
The "enter" animation used on a Dialog component does not work with the new API.
Steps to reproduce the bug
Provide a repo or sandbox with the bug and describe the steps to reproduce it.
Note: this can also be reproduced on the Reakit website.
Expected behavior
"Enter" doesn't get triggered in some scenarios:
Environment
MacOS 10.15.2
Firefox 76.0.1
Chrome 81.0.40
Reakit 1.0.0
Note: It was working up until reakit 1.0.0-beta.16
The text was updated successfully, but these errors were encountered: