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

[Web LA] Fix chrome flickers #6172

Merged
merged 3 commits into from
Jul 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,20 @@ export function setElementAnimation(
) {
const { animationName, duration, delay, easing } = animationConfig;

element.style.animationName = animationName;
element.style.animationDuration = `${duration}s`;
element.style.animationDelay = `${delay}s`;
element.style.animationTimingFunction = easing;
const configureAnimation = () => {
element.style.animationName = animationName;
element.style.animationDuration = `${duration}s`;
element.style.animationDelay = `${delay}s`;
element.style.animationTimingFunction = easing;
};

if (animationConfig.animationType === LayoutAnimationType.ENTERING) {
// On chrome sometimes entering animations flicker. This is most likely caused by animation being interrupted
// by already started tasks. To avoid flickering, we use `requestAnimationFrame`, which will run callback right before repaint.
requestAnimationFrame(configureAnimation);
} else {
configureAnimation();
}

element.onanimationend = () => {
if (shouldSavePosition) {
Expand Down