Skip to content

Instantly share code, notes, and snippets.

@nsulistiyawan
Last active May 1, 2022 00:44
Show Gist options
  • Save nsulistiyawan/faa76bd3f196254202c706ad43362d17 to your computer and use it in GitHub Desktop.
Save nsulistiyawan/faa76bd3f196254202c706ad43362d17 to your computer and use it in GitHub Desktop.
lottie-splash-one
import React, {useState} from 'react';
import {Text, View, StyleSheet} from 'react-native';
import LottieView from 'lottie-react-native';
const App = () => {
const [lottieLoaded, setLottieLoaded] = useState(false);
if (!lottieLoaded) {
return (
<View style={styles.text}>
<LottieView
source={require('./assets/eid-mubarak-lottie.json')}
autoPlay
loop={false}
resizeMode="contain"
onAnimationFinish={() => {
setLottieLoaded(true);
}}
/>
</View>
);
}
return (
<View style={styles.text}>
<Text> Hello Lottie Splash! </Text>
</View>
);
};
const styles = StyleSheet.create({
text: {
alignItems: 'center',
flex: 1,
justifyContent: 'center',
fontWeight: 'bold',
},
});
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment