import { useEffect, useState } from 'react'; import * as Font from 'expo-font'; import { SplashScreen } from 'expo'; /** * Load and use resources that need to be loaded async by Expo SDK */ const useExpoResources = () => { const [isLoading, setIsLoading] = useState(true); /** * Load resources and prevents SplashScreen from hiding until completed */ useEffect(() => { SplashScreen.preventAutoHide(); const loadFonts = async () => { try { await Font.loadAsync({ SomeFont: require('../../assets/fonts/SomeFont.ttf'), }); setIsLoading(false); SplashScreen.hide(); } catch (error) { // handle error } }; loadFonts(); }, []); return isLoading; }; export default useExpoResources;