Skip to content

Instantly share code, notes, and snippets.

@dmnkgrc
Created March 22, 2021 17:11
Show Gist options
  • Select an option

  • Save dmnkgrc/44010eb68522a944ef5cbd610d9c48f3 to your computer and use it in GitHub Desktop.

Select an option

Save dmnkgrc/44010eb68522a944ef5cbd610d9c48f3 to your computer and use it in GitHub Desktop.
The Splash Screen component
const Splashscreen = (props) => {
const [hasAnimationPlayedOnce, setHasAnimationPlayedOnce] = React.useState(false)
// We only want to hide the Splash Screen after it has played at least once
const handleAnimationFinish = () => {
setHasAnimationPlayedOnce(true)
}
const isModalVisible = !(props.isAppInitialized && hasAnimationPlayedOnce)
return (
<Modal visible={isModalVisible} animationType="fade">
<LottieView
source={animatedLogo}
loop={false}
autoPlay
onAnimationFinish={handleAnimationFinish}
/>
</Modal>
)
}
const mapStateToProps = (state) => ({
isAppInitialized: appInitSelectors.isAppInitialized(state),
})
export default connect(mapStateToProps)(Splashscreen)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment