-
-
Save AllGistsEqual/0c87c1d488a9c8e0cee5848231530459 to your computer and use it in GitHub Desktop.
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
// 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