Skip to content

Instantly share code, notes, and snippets.

@AllGistsEqual
Created May 2, 2021 19:28
Show Gist options
  • Save AllGistsEqual/0c87c1d488a9c8e0cee5848231530459 to your computer and use it in GitHub Desktop.
Save AllGistsEqual/0c87c1d488a9c8e0cee5848231530459 to your computer and use it in GitHub Desktop.
// File: src/screens/AppLoadingScreen.tsx (partial)
import React, { useCallback } from 'react'
import { Text, View, StyleSheet } from 'react-native'
import { useFocusEffect } from '@react-navigation/native'
import { useReduxDispatch } from '../../redux'
import { setRunning } from '../../redux/ducks/appState'
const AppLoadingScreen = (): React.ReactElement => {
const dispatch = useReduxDispatch()
useFocusEffect(
useCallback(() => {
setTimeout(() => {
/*
* fake timer where you would instead
* load and check the user data before
* you send the user to the App Stack
*/
dispatch(setRunning(true))
}, 1500)
}, [dispatch]),
)
return (
<View style={styles.page}>
<Text>loading User Data...</Text>
</View>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment