-
Notifications
You must be signed in to change notification settings - Fork 14
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
Data load error from URL #449
Comments
I encountered the same problem. This error occurs randomly, on some page refresh it works fine, but errors on other page refresh. I didn't find the pattern after several hours trying, just random, fail more(9 out of 10), work less (1 out of 10). I have already searched issues, found a similar one: #260, but in my scenario the component (and its direct parent) is renderd without any My code is like: <DotLottieReact
className="w-[400px] h-[200px]"
src="https://.../some-animation.lottie"
loop
autoplay
/> The rendered dom is: <div class="w-[400px] h-[200px]">
<canvas width="0" height="0" style="width: 100%; height: 100%;"></canvas>
</div> I tried to pass props |
In my case it happens on every re-render. Also thanks for linking that issue, I'm going to try solutions mentioned in there and check whether any of them work. |
Can you provide the |
my versions:
|
|
Well, apparently my issue was caused because the player parent component was using Besides this, I still have 2 questions: 1) Is it possible to use Thanks for any input. |
duplicate #260 |
Yes, you can use the import { useState, useEffect } from "react";
import { DotLottieReact } from "@lottiefiles/dotlottie-react";
const App = () => {
const [dotLottieInstance, setDotLottieInstance] = useState(null);
const [isReady, setIsReady] = useState(false);
useEffect(() => {
const onReady = () => {
setIsReady(true);
};
if (dotLottieInstance) {
dotLottieInstance.addEventListener("ready", onReady);
}
return () => {
dotLottieInstance?.removeEventListener("ready", onReady);
};
}, [dotLottieInstance]);
useEffect(() => {
if (dotLottieInstance && isReady) {
dotLottieInstance.play();
}
}, [dotLottieInstance, isReady]);
return (
<DotLottieReact
dotLottieRefCallback={setDotLottieInstance}
src={ANIMATION_URL}
loop
/>
);
};
export default App;
The Alternatively, you might consider using the dotLottie theming feature available in Lottie Creator. This feature allows you to create multiple themes for the same animation and dynamically switch between them using the dotLottie players without direct CSS manipulation. |
Thanks for your input. I don't think reverting back to |
@StephenPCG @Aurimas-stack This issue should be resolved in dotlottie-react v0.12.2. If the issue still persists, please feel free to reopen. |
Hello team,
I wanted to use
dotlottie-react
package for my Next.js application but I'm running into an error that seems to be coming from the library:Failed to load animation from URL: "exampleURL.lottie". IndexSizeError: Index or size is negative or greater than allowed amount
. This error happens also fordotlottie-wc
package component if I try using it in the application.The setup I'm using is very basic, I'm just importing the component, add
src
,loop
andautoplay
attributes and that's it.I'm not sure why this is happening, perhaps I'm missing something, previously with
@dotlottie/player-component
loaded.lottie
animations from URL were (and still are) working fine.Thank you for your input.
The text was updated successfully, but these errors were encountered: