I’m facing a similar issue, where the app is usually taking 5-10seconds on the splash screen alone. I’m unclear why this is happening, and what exactly is happening that is taking so long.
All I do is cacheFonts
on the AppLoading screen. All my images are in the ./assets/
directory, which should be included in the binary. I opened the .ipa file and I can see the image present there, so that seems to work as expected.
I also set fallbackToCacheTimeout
to 0
so (if I understand it correctly) the app loading shouldn’t block on loading the javascript bundle, but instead simply load it asynchronously in the background for the next time the app is loaded.
I copied all the relevant App.js
and app.json
sections below for reference.
It’s difficult to test out changes much for this because I need to load a new build with the AppStore each time. If anyone has any suggestions to reduce splash screen time, that’d be super helpful.
Also, I have done the suggestions for “Offline Support”, but that doesn’t seem to help anymore.
QUESTION: Do all package.json packages get included in the binary as well? I would assume so, but wasn’t sure if that could be a reason why it’s taking so long. (I’m using react, react-native, redux relevant packages, expo, sentry-expo, react-native-elements, and a few others).
(NOTE: I do have Sentry installed. Maybe that is what is causing an issue with “Offline Support”? I’m going to check if Sentry (sentry-expo) is what is taking the SplashScreen to take so long. Will update if that is the issue.)
Running: (same as the initial post on this thread)
“expo”: “^30.0.0”,
“react”: “16.3.1”,
“react-native”: “https://github.com/expo/react-native/archive/sdk-30.0.0.tar.gz”,
app.json:
{
"expo": {
...,
"splash": { "backgroundColor" "#ffffff", "resizeMode": "contain", "image": "./assets/SplashImage.png" },
"assetBundlePatterns": [ "./assets/**" ],
"updates": { "enabled": true, "checkAutomatically": "ON_LOAD", "fallbackToCacheTimeout": 0 }
}
}
App.js:
Sentry.config(SENTRY_DSN).install();
const cacheFonts = (fonts) => {
return fonts.map(font => Expo.Font.loadAsync(font));
}
export default class App extends React.component {
constructor(props) {
super(props);
this.state = { isReady: false }
}
async loadAssetsAsync() {
const fontAssets = cacheFonts([ Ionicons.font ]);
await Promise.all([...fontAssets]);
}
render() {
if (!this.state.isReady) {
return (
<Expo.AppLoading
startAsync={ this.loadAssetsAsync }
onFinish={() => this.setState({ isReady: true }) }
onError={ console.warn }
/>
);
}
return (
<MyMainAppView />
);
}
}