How do I only show the SplashScreen instead of an emtpy view when waiting for loading the fonts and other async tasks? The problem I’m currently facing is that when the fonts are not loaded, a white empty view with a title gets display, which is very annoying.
This is my current code:
import { SplashScreen, Stack } from "expo-router";
import { useFonts } from "expo-font"
import { useEffect } from "react";
SplashScreen.preventAutoHideAsync();
export default function App() {
const [fontsLoaded, fontError] = useFonts({
"Poppins-Black": require("../assets/fonts/Poppins-Black.ttf"),
"Poppins-Bold": require("../assets/fonts/Poppins-Bold.ttf"),
...
})
useEffect(() => {
if (fontError) throw fontError;
if (fontsLoaded) SplashScreen.hideAsync();
}, [fontsLoaded, fontError])
if (!fontsLoaded && !fontError) {
return null;
}
return (
<Stack>
<Stack.Screen name="(tabs)" options={{ headerShown: false }} />
</Stack>
);
}
I also tried returning the deprecated component which also did not work