Skip to content

Instantly share code, notes, and snippets.

@ajsmth
Last active May 21, 2021 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajsmth/f8ed0b1074d260982708bd1ceb13311c to your computer and use it in GitHub Desktop.
Save ajsmth/f8ed0b1074d260982708bd1ceb13311c to your computer and use it in GitHub Desktop.
Splash Screen Hanger
import React, { useState, useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';
import * as SplashScreen from 'expo-splash-screen';
import * as Font from 'expo-font';
import Entypo from '@expo/vector-icons/Entypo';
async function doSomeAsyncWork() {
throw new Error('123');
}
async function prepare() {
await SplashScreen.preventAutoHideAsync();
// setTimeout(() => {
// throw new Error('Hiyo');
// }, 2000);
await doSomeAsyncWork();
await SplashScreen.hideAsync();
}
export default function App() {
useEffect(() => {
prepare();
}, []);
return (
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
<Text>SplashScreen Demo! 👋</Text>
<Entypo name="rocket" size={30} />
</View>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment