@remotion/lottie
Advanced tools
Comparing version 3.2.28 to 3.2.29
/// <reference types="react" /> | ||
import type { LottieProps } from './types'; | ||
export declare const Lottie: ({ animationData, className, direction, loop, playbackRate, style, }: LottieProps) => JSX.Element; | ||
export declare const Lottie: ({ animationData, className, direction, loop, playbackRate, style, onAnimationLoaded, }: LottieProps) => JSX.Element; |
@@ -14,3 +14,3 @@ "use strict"; | ||
const validate_playbackrate_1 = require("./validate-playbackrate"); | ||
const Lottie = ({ animationData, className, direction, loop, playbackRate, style, }) => { | ||
const Lottie = ({ animationData, className, direction, loop, playbackRate, style, onAnimationLoaded, }) => { | ||
if (typeof animationData !== 'object') { | ||
@@ -24,5 +24,8 @@ throw new Error('animationData should be provided as an object. If you only have the path to the JSON file, load it and pass it as animationData. See https://remotion.dev/docs/lottie/lottie#example for more information.'); | ||
const containerRef = (0, react_1.useRef)(null); | ||
const onAnimationLoadedRef = (0, react_1.useRef)(); | ||
onAnimationLoadedRef.current = onAnimationLoaded; | ||
const [handle] = (0, react_1.useState)(() => (0, remotion_1.delayRender)('Waiting for Lottie animation to load')); | ||
const frame = (0, remotion_1.useCurrentFrame)(); | ||
(0, react_1.useEffect)(() => { | ||
var _a; | ||
if (!containerRef.current) { | ||
@@ -44,2 +47,3 @@ return; | ||
animation.addEventListener('DOMLoaded', onComplete); | ||
(_a = onAnimationLoadedRef.current) === null || _a === void 0 ? void 0 : _a.call(onAnimationLoadedRef, animation); | ||
return () => { | ||
@@ -46,0 +50,0 @@ lastFrameRef.current = animation.currentFrame; |
@@ -0,1 +1,2 @@ | ||
import type { AnimationItem } from 'lottie-web'; | ||
import type { CSSProperties } from 'react'; | ||
@@ -33,2 +34,6 @@ export declare type LottieAnimationData = { | ||
style?: CSSProperties; | ||
/** | ||
* Callback that gets invoked when new animation data has been initialized | ||
*/ | ||
onAnimationLoaded?: (animation: AnimationItem) => void; | ||
}; |
{ | ||
"name": "@remotion/lottie", | ||
"version": "3.2.28", | ||
"version": "3.2.29", | ||
"description": "Remotion Lottie", | ||
@@ -30,3 +30,3 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"remotion": "3.2.28" | ||
"remotion": "3.2.29" | ||
}, | ||
@@ -62,3 +62,3 @@ "peerDependencies": { | ||
}, | ||
"gitHead": "49bb70afa503bfb0c89ee51d8bf3386ad1b91ac4" | ||
"gitHead": "9a2ff4d68324af8d1fe55ebdf94bdadccf446a10" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16136
286
+ Addedremotion@3.2.29(transitive)
- Removedremotion@3.2.28(transitive)
Updatedremotion@3.2.29