Skip to content

Commit

Permalink
chore(lottie): migrate to lottie-react library (#1084)
Browse files Browse the repository at this point in the history
The original react-lottie library seems to be abandoned and still uses
deprecated React lifecycle methods [1]. These methods will be removed in
React 17.

Hence, migrate to lottie-react instead, which fixes the issue and is
expected to have React 17 support [2].

[1]: chenqingspring/react-lottie#119
[2]: Gamote/lottie-react#29
  • Loading branch information
zwliew committed Mar 30, 2021
1 parent e1ebb75 commit afd5478
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 32 deletions.
38 changes: 16 additions & 22 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"@sentry/browser": "^5.27.6",
"@types/bcryptjs": "^2.4.2",
"@types/papaparse": "^5.0.3",
"@types/react-lottie": "^1.2.5",
"@types/validator": "^13.0.0",
"axios": "^0.21.1",
"boxicons": "^2.0.5",
Expand All @@ -32,6 +31,7 @@
"escape-html": "^1.0.3",
"html-to-draftjs": "^1.5.0",
"lodash": "^4.17.21",
"lottie-react": "^2.1.0",
"moment": "^2.24.0",
"papaparse": "^5.2.0",
"postman-templating": "file:../modules/postman-templating",
Expand All @@ -40,7 +40,6 @@
"react-dom": "^16.13.1",
"react-draft-wysiwyg": "^1.14.5",
"react-ga": "^2.7.0",
"react-lottie": "^1.2.3",
"react-moment": "^0.9.7",
"react-paginate": "^6.3.2",
"react-player": "^2.6.2",
Expand Down
14 changes: 6 additions & 8 deletions frontend/src/components/landing/Landing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useContext, useEffect } from 'react'
import { Redirect, useHistory } from 'react-router-dom'
import { OutboundLink } from 'react-ga'
import cx from 'classnames'
import Lottie from 'react-lottie'
import Lottie from 'lottie-react'

import { LINKS, INFO_BANNER } from 'config'

Expand Down Expand Up @@ -187,13 +187,11 @@ const Landing = () => {
<img src={landingHeroImg} className={styles.landingHero} alt="" />
) : (
<Lottie
options={{
loop: false,
autoplay: true,
animationData: landingAnimation,
rendererSettings: {
preserveAspectRatio: 'xMidYMid slice',
},
loop={false}
autoplay={true}
animationData={landingAnimation}
rendererSettings={{
preserveAspectRatio: 'xMidYMid slice',
}}
/>
)}
Expand Down

0 comments on commit afd5478

Please sign in to comment.