React Native Advanced - auth and splash screen - Tip

The AppLoading component is no longer in the basic expo library.
You need to change the import statement to:
import AppLoading from “expo-app-loading”;
(And, of course, install that library.)

Also, the AppLoading API requires an onError prop – otherwise an error gets thrown that doesn’t mention this specific problem. So, here’s an example:
<AppLoading startAsync={restoreUser} onFinish={() => setIsReady(true)} onError={console.warn} />

5 Likes

Thanks dpickut!
I was missing onError={console.warn}.
But I was still getting an error.

The wackiest thing FIXED my problem.
I changed:
import {AppLoading} from ‘expo-app-loading’;
to:
import AppLoading from ‘expo-app-loading’;

Deprecated now.
Use instead expo-splash-screen. Just make sure to make the call to onLayoutRootView in the right place