adrianhajdin / aora

Build your first mobile application
https://jsmastery.pro
1.41k stars 259 forks source link

fontFamily "Poppins-SemiBold" is not a system font and has not been loaded through expo-font. #22

Closed ankitjasbeersingh closed 3 months ago

ankitjasbeersingh commented 3 months ago

I'm getting this following error.

ankitjasbeersingh commented 3 months ago
when I changed code from 
useEffect(() => {
    if (error) {throw error};
    if (fontsLoaded) SplashScreen.hideAsync();
    if (!fontsLoaded && !error) return;
}, [fontsLoaded, error])
to
useEffect(() => {
    if (error) throw error;

    if (fontsLoaded) {
      SplashScreen.hideAsync();
    }
  }, [fontsLoaded, error]);

  if (!fontsLoaded) {
    return null;
  }

  if (!fontsLoaded && !error) {
    return null;
  }

  it resolves my issue
ankitjasbeersingh commented 3 months ago

it works when I changed

useEffect(() => { if (error) {throw error}; if (fontsLoaded) SplashScreen.hideAsync(); if (!fontsLoaded && !error) return; }, [fontsLoaded, error])

to useEffect(() => { if (error) throw error;

if (fontsLoaded) {
  SplashScreen.hideAsync();
}

}, [fontsLoaded, error]);

if (!fontsLoaded) { return null; }

if (!fontsLoaded && !error) { return null; }