-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Splash Screen): add splash screen, add new translations, update …
…README
- Loading branch information
afenerol
committed
Oct 6, 2020
1 parent
1b428a6
commit 0f4f38b
Showing
11 changed files
with
149 additions
and
75 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { Component } from 'react'; | ||
import Launch from '../layout/Launch'; | ||
|
||
const WithSplashScreen = <P extends object>( | ||
WrappedComponent: React.ComponentType<P> | ||
) => { | ||
return class extends Component<P, { loading: boolean }> { | ||
constructor(props: Readonly<P>) { | ||
super(props); | ||
this.state = { | ||
loading: true, | ||
}; | ||
} | ||
|
||
componentDidMount() { | ||
try { | ||
setTimeout(() => { | ||
this.setState({ | ||
loading: false, | ||
}); | ||
}, 4000) | ||
} catch (err) { | ||
console.log(err); | ||
this.setState({ | ||
loading: false, | ||
}); | ||
} | ||
} | ||
|
||
render() { | ||
// while checking user session, show "loading" message | ||
if (this.state.loading) return <Launch />; | ||
|
||
// otherwise, show the desired route | ||
return <WrappedComponent {...this.props} />; | ||
} | ||
}; | ||
} | ||
|
||
export default WithSplashScreen; |
This file contains 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
This file contains 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
This file contains 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