Moved assets loading in constructor to improve loading time

This commit is contained in:
Arnaud Vergnet 2020-04-20 14:28:32 +02:00
parent f0772dff38
commit 774f28a32e

10
App.js
View file

@ -66,6 +66,9 @@ export default class App extends React.Component<Props, State> {
this.urlHandler = new URLHandler(this.onInitialURLParsed, this.onDetectURL); this.urlHandler = new URLHandler(this.onInitialURLParsed, this.onDetectURL);
this.urlHandler.listen(); this.urlHandler.listen();
setSafeBounceHeight(Platform.OS === 'ios' ? 100 : 20); setSafeBounceHeight(Platform.OS === 'ios' ? 100 : 20);
this.loadAssetsAsync().then(() => {
this.onLoadFinished();
});
} }
/** /**
@ -133,12 +136,6 @@ export default class App extends React.Component<Props, State> {
this.storageManager.savePref(this.storageManager.preferences.showAprilFoolsStart.key, '0'); this.storageManager.savePref(this.storageManager.preferences.showAprilFoolsStart.key, '0');
}; };
componentDidMount() {
this.loadAssetsAsync().then(() => {
this.onLoadFinished();
});
}
/** /**
* Loads every async data * Loads every async data
* *
@ -175,7 +172,6 @@ export default class App extends React.Component<Props, State> {
showUpdate: this.storageManager.preferences.updateNumber.current !== Update.number.toString(), showUpdate: this.storageManager.preferences.updateNumber.current !== Update.number.toString(),
showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled() && this.storageManager.preferences.showAprilFoolsStart.current === '1', showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled() && this.storageManager.preferences.showAprilFoolsStart.current === '1',
}); });
// SplashScreen.hide();
} }
/** /**