50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
// Metro module 7781 (f7782).
|
|
import Module19, { useEffect, useRef } from "react";
|
|
import { requireNativeComponent } from "react-native";
|
|
import { isAndroid } from "../../../utils/PlatformUtils";
|
|
import Module7782 from "../../../_bundle/Module7782";
|
|
import codegenNativeCommands from "../../../_bundle/codegenNativeCommands";
|
|
const NativeLottieNode = isAndroid() ? Module7782 : requireNativeComponent("NativeLottieNode");
|
|
let c4902_5 = codegenNativeCommands({
|
|
supportedCommands: ["setup"]
|
|
});
|
|
let c4902_6 = {
|
|
LOOP: 0,
|
|
0: "LOOP",
|
|
STILL: 1,
|
|
1: "STILL",
|
|
ONCE: 2,
|
|
2: "ONCE"
|
|
};
|
|
export default function NativeLottieView(props) {
|
|
const { asset, url, width, height, opacity = 1, renderMode = c4902_6.LOOP } = props;
|
|
const LOOP = renderMode;
|
|
const { animating = true, accessibilityLabel } = props;
|
|
const ref = Module19.useRef(null);
|
|
const current = {
|
|
asset,
|
|
url,
|
|
width,
|
|
height,
|
|
animating,
|
|
accessibilityLabel
|
|
};
|
|
const ref2 = useRef(current);
|
|
useEffect(() => {
|
|
ref2.current = current;
|
|
});
|
|
useEffect(() => {
|
|
const current2 = ref2.current;
|
|
const { asset, url, width, height, animating, accessibilityLabel } = current2;
|
|
if (url !== "" && width !== 0 && height !== 0) {
|
|
c4902_5.setup(ref.current, asset, url, width, height, LOOP, animating, accessibilityLabel);
|
|
}
|
|
}, [LOOP]);
|
|
return <NativeLottieNode ref={ref} style={{
|
|
width,
|
|
height,
|
|
opacity
|
|
}} />;
|
|
};
|
|
export { c4902_6 as NativeLottieRenderMode };
|