Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using lottie-react-web, Im getting the following console error: <svg> attribute viewBox: Expected number, "0 0 undefined undefined

I've created a component from the lottie-react-web package.

import React from 'react';
import Lottie from 'lottie-react-web'
import animation from '../../src/animations/anim.json'

const LottieAnim = () => (
  <Lottie
    options = {{
      animationData: animation,
      loop: false,
      autoplay: true,
    }}
    width = "60px"
    height = "60px"
  />
)

export default LottieAnim

This works and builds successfully. When the DOM loads it is generating the wrapper div with the attributes defined. However, the svg in the div does not have defined viewbox parameters, as well as undefined width and height, along with the containing vectors inside the svg.

enter image description here

like image 447
Carey Estes Avatar asked Dec 14 '25 18:12

Carey Estes


1 Answers

Should be animationData: animationData.default

See: https://github.com/chenqingspring/vue-lottie/issues/20

like image 176
janekkkk Avatar answered Dec 18 '25 12:12

janekkkk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!