Lottie react native is not working for me

  1. SDK Version: 48
  2. Platforms(Android/iOS/web/all): Android

I am trying to display lottie animation with lottie-react-native library. On using lottie-react-native library in my expo project returning “Cannot read property ‘Commands’ of null” error. Could somebody please help.

Here is my code:

import React, { useRef, useEffect } from ‘react’;
import { Button, StyleSheet, View } from ‘react-native’;
import LottieView from ‘lottie-react-native’;

export default function MyAnimation() {
const animation = useRef(null);

return (

<LottieView
autoPlay
ref={animation}
style={{
width: 200,
height: 200,
backgroundColor: ‘#eee’,
}}
// Find more Lottie files at Featured animations from our community
source={require(‘…/assets/loader.json’)}
/>

<Button
title=“Restart Animation”
onPress={() => {
animation.current?.reset();
animation.current?.play();
}}
/>


);
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.