{"id":46,"date":"2021-04-16T13:07:47","date_gmt":"2021-04-16T13:07:47","guid":{"rendered":"https:\/\/rhwbaldwin.com\/blog\/?p=46"},"modified":"2024-11-13T23:00:43","modified_gmt":"2024-11-13T23:00:43","slug":"issues-getting-started-with-lottie-in-react-native","status":"publish","type":"post","link":"https:\/\/rhwbaldwin.com\/blog\/2021\/04\/16\/issues-getting-started-with-lottie-in-react-native\/","title":{"rendered":"Issues Getting Started with Lottie in React Native"},"content":{"rendered":"<h2>Issues Getting Started with Lottie in React Native<\/h2>\t\t\n\t\t<p><\/p>\n<p>The promise of <a href=\"https:\/\/lottiefiles.com\/\" target=\"_blank\" rel=\"noreferrer noopener\" data-type=\"URL\" data-id=\"https:\/\/lottiefiles.com\/\">Lottie<\/a> is almost too good to be true: beautiful animations requiring 1\/6th the normal processing oomph. What&#8217;s not to love?<\/p>\n<p><\/p>\n<p><\/p>\n<p>I&#8217;d suggested using <a href=\"https:\/\/lottiefiles.com\/what-is-lottie\" target=\"_blank\" rel=\"noreferrer noopener\" data-type=\"URL\" data-id=\"https:\/\/lottiefiles.com\/what-is-lottie\">Lottie<\/a> in a project at work, but we ended up resorting to plain old gifs instead because the iOS dev was ______. Anywho, not gonna speculate about what exactly the iOS dev was thinking.<\/p>\n<p><\/p>\n<p><\/p>\n<p>I wanted to try Lottie out myself so I set to work following the <a href=\"https:\/\/github.com\/lottie-react-native\/lottie-react-native#installing-react-native--0600\" target=\"_blank\" rel=\"noreferrer noopener\" data-type=\"URL\" data-id=\"https:\/\/github.com\/lottie-react-native\/lottie-react-native#installing-react-native--0600\">standard instructions in Github<\/a>.<\/p>\n<p><\/p>\n<p><\/p>\n<p>The first time I encountered a difficult issue: I couldn&#8217;t get the animation to load at all. No error, no disruption to surrounding text or images. No nada. It just wasn&#8217;t showing up.<\/p>\n<p><\/p>\n<p><\/p>\n<p>It was frustrating, but I was intrigued. But I also had a deadline, so I got distracted and put Lottie aside for a few weeks.<\/p>\n<p><\/p>\n<p><\/p>\n<p>Finally ready to try again, I realized the issue when I&#8217;d remembered another similar error with displaying images from external sources&#8230; the height and width must be defined. For giggles I added inline styles of height and width at 150 and voil\u00e1! <\/p>\n<p>\u00a0<\/p>\n<p><\/p>\n<p><\/p>\n<p><\/p>\t\t\n<lottie-player\n  autoplay\n  controls\n  loop\n  mode=\"normal\"\n  src=\"https:\/\/assets7.lottiefiles.com\/private_files\/lf30_nivslwok.json\"\n  style=\"width: 95%; text-align:center;margin-left:auto;margin-right:auto;\"\n>\n<\/lottie-player>","protected":false},"excerpt":{"rendered":"<p>Issues Getting Started with Lottie in React Native The promise of Lottie is almost too good to be true: beautiful animations requiring 1\/6th the normal processing oomph. What&#8217;s not to love? I&#8217;d suggested using Lottie in a project at work, but we ended up resorting to plain old gifs instead because the iOS dev was&hellip; <br \/> <a class=\"read-more\" href=\"https:\/\/rhwbaldwin.com\/blog\/2021\/04\/16\/issues-getting-started-with-lottie-in-react-native\/\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":47,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-46","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-react-native"],"_links":{"self":[{"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/posts\/46","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/comments?post=46"}],"version-history":[{"count":21,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/posts\/46\/revisions"}],"predecessor-version":[{"id":74,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/posts\/46\/revisions\/74"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/media\/47"}],"wp:attachment":[{"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/media?parent=46"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/categories?post=46"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rhwbaldwin.com\/blog\/wp-json\/wp\/v2\/tags?post=46"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}