Page Goes Blank/White Momentarily When Scrolling Fast with Rive Animations
Description:
I've integrated Rive animations into my Nextjs project using @rive-app/react-canvas. The animations load and function correctly, but I've encountered an issue where the page goes blank or white for a moment when scrolling quickly. This problem is intermittent and seems to occur on certain OS and browser combinations. Also this problem starts happening when multiple animations are present on a single page and appears once they are loaded.
Steps to Reproduce:
Integrate Rive animations using the provided AnimationComponent in a React project.
Deploy the project and access it on an iPhone 13 using Chrome or Safari, or on an iPhone 11 using Safari.
Scroll quickly up and down the page.
Expected Behavior:
The page should scroll smoothly without any interruptions or blank/white screens.
Actual Behavior:
The page intermittently goes blank/white for a moment when scrolling fast. The animations themselves load and function fine.
Affected OS and Browsers:
iPhone 13: Occurs on both Chrome and Safari.
iPhone 11: Occurs only on Safari ( chrome is fine).
Macbook air ( macOS Ventura 13.4 ) : Occurs on safari ( on chrome its fine)
library version:
@rive-app/react-canvas: 4.12.1,
next: 13.1.2
My code:
Parent Component:
{section.animation && (
)}
Animation Component:
import React, { useState } from "react";
import { useStateMachineInput, useRive } from "@rive-app/react-canvas";
import Spinner from "./Spinner";
interface AnimationComponentProps {
src: string;
}
const AnimationComponent: React.FC = ({ src }) => {
const [isAnimationLoaded, setIsAnimationLoaded] = useState(false);
const { RiveComponent, rive } = useRive({
src: src,
stateMachines: "State Machine 1",
autoplay: true,
onLoad: () => {
setIsAnimationLoaded(true);
},
});
return (
<>
{!isAnimationLoaded && (
)}
<div
className="md:flex-1 md:h-96 h-64 border rounded shadow mx-auto my-20"
style={{
display: isAnimationLoaded ? "block" : "none",
}} // Hide animation until loaded
>
</>
);
};
export default AnimationComponent;
Hello!
Thanks for the detailed description. Would you be able to share a video clip and/or codesandbox that shows this white screen issue so we can make sure we're reproducing it correctly on our end?
If you don't want to post this on the forum, feel free to open a ticket here to share it with the team privately.
Hello ,
here is the video
https://www.loom.com/share/d3aae4d8e5f54262a117c7cf87fb049d?sid=d3897729-66e6-4ad2-88f1-69c6046fff45
I have raised the bug on your given link https://rive.atlassian.net/servicedesk/customer/portal/3/RIV-5032?token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ0Z3QiOiJhbm9ueW1vdXMtbGluayIsInFzaCI6ImRkMTk1MWI2NDVmM2NhMzE1ZmIxMjBiMzM2ZjIxYzY5ODI2OWIyZWNiZDUzODU4ODI1MWRiZWYxMTIyOGJmNGQiLCJpc3MiOiJzZXJ2aWNlZGVzay1qd3QtdG9rZW4taXNzdWVyIiwiY29udGV4dCI6eyJ1c2VyIjoiMTIxMTciLCJpc3N1ZSI6IlJJVi01MDMyIn0sImV4cCI6MTcyNDE2ODkxNSwiaWF0IjoxNzIxNzQ5NzE1fQ.Z3o_A15cU4HRGjTu8je1SKLon0EPSwOeg3gajDMszQw , Thanks