Skip to content

Instantly share code, notes, and snippets.

@AllGistsEqual
Created April 25, 2021 21:03
Show Gist options
  • Save AllGistsEqual/40c98a7f0d067e8503ae1f70dc12e0ad to your computer and use it in GitHub Desktop.
Save AllGistsEqual/40c98a7f0d067e8503ae1f70dc12e0ad to your computer and use it in GitHub Desktop.
// File: src/screens/SplashScreen.tsx
// (partial)
const SplashScreen = ({ navigation }: SplashScreenProps): React.ReactElement => {
const navigate = useCallback(
() => navigation.navigate(MainRoutes.AppCheck),
[navigation],
)
useFocusEffect(
useCallback(() => {
const navigationTimer = setTimeout(() => {
navigate()
}, 3000)
return (): void => clearTimeout(navigationTimer)
}, [navigate]),
)
return (
<TouchableWithoutFeedback onPress={() => navigate()}>
/* skipped for brevity ... */
</TouchableWithoutFeedback>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment