Created
August 10, 2019 13:29
-
-
Save hroland/8fe9bafd84b01796f9d8cb27057cc4f6 to your computer and use it in GitHub Desktop.
Revisions
-
hroland created this gist
Aug 10, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,58 @@ import { AppLoading } from 'expo'; import { Asset } from 'expo-asset'; import * as Font from 'expo-font'; import React, { useState } from 'react'; import { Platform, StatusBar, StyleSheet, View } from 'react-native'; import { Ionicons, Feather, MaterialCommunityIcons } from '@expo/vector-icons'; import AppNavigator from './navigation/AppNavigator'; export default function App(props) { const [isLoadingComplete, setLoadingComplete] = useState(false); if (!isLoadingComplete && !props.skipLoadingScreen) { return ( <AppLoading startAsync={loadResourcesAsync} onError={handleLoadingError} onFinish={() => handleFinishLoading(setLoadingComplete)} /> ); } else { return ( <View style={styles.container}> {Platform.OS === 'ios' && <StatusBar barStyle="default" />} <AppNavigator /> </View> ); } } async function loadResourcesAsync() { await Promise.all([ Asset.loadAsync([ ]), Font.loadAsync({ ...Ionicons.font, ...Feather.font, ...MaterialCommunityIcons.font, }), ]); } function handleLoadingError(error) { // In this case, you might want to report the error to your error reporting // service, for example Sentry console.warn(error); } function handleFinishLoading(setLoadingComplete) { setLoadingComplete(true); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', }, });