Lottie animation not working in new remix version #7581
-
When I try to use Lottie animation in the remix, it gives this error
My code:
|
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
I'm having the same issue! |
Beta Was this translation helpful? Give feedback.
-
Having the same issue with react-fast-marquee |
Beta Was this translation helpful? Give feedback.
-
Working for me. If you are using Content Security Policy (CSP) on your server, include 'unsafe-eval' in the script-src directive. import { Outlet } from '@remix-run/react'
import Tr from 'lottie-react'
import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
import { Spacer } from '#app/components/spacer.tsx'
import callcenter from '../../lotties/call-center.json'
import { useNonce } from '#app/utils/nonce-provider.ts'
const Lottie = Tr.default
export default function CallCenterLayout() {
const nonce = useNonce()
console.log({ d: nonce })
return (
<div>
<Spacer size="4xs" />
<main>
<Outlet />
<Lottie nonce={nonce} animationData={callcenter} />
</main>
</div>
)
} |
Beta Was this translation helpful? Give feedback.
-
This works `import React from "react"; const style = { export default function EmptyLottie() { const { View } = useLottie(options, style); return {View} ;} ` |
Beta Was this translation helpful? Give feedback.
-
For me work use this example
|
Beta Was this translation helpful? Give feedback.
This works
`import React from "react";
import { useLottie } from "lottie-react";
import lottie from "~/assets/empty.json";
const style = {
height: 300,
};
export default function EmptyLottie() {
const options = {
animationData: lottie,
loop: true,
autoplay: true,
};
const { View } = useLottie(options, style);
return
}
`