Created
March 22, 2021 17:11
-
-
Save dmnkgrc/44010eb68522a944ef5cbd610d9c48f3 to your computer and use it in GitHub Desktop.
The Splash Screen component
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
| 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