Last active
May 1, 2022 00:44
-
-
Save nsulistiyawan/faa76bd3f196254202c706ad43362d17 to your computer and use it in GitHub Desktop.
lottie-splash-one
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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