Using remote Lottie files
For optimal performance, animations should be included locally within the app's folder structure but, in some cases, it could be useful to use a remote JSON file as a Lottie animation to be rendered in our React Native apps. For these cases, lottie-react-native
allows us to transparently specify a remote URL as the source of the animation through the source prop passed to LottieView
.
Let's see how our initial example would look if we used a remote animation instead of a local one:
import React from 'react';
import LottieView from 'lottie-react-native';
import {SafeAreaView, View, StyleSheet} from 'react-native';
const App = () => {
return (
<SafeAreaView>
<View style={styles.container}>
<LottieView
...