From f0772dff3871fc815c4b69804995f8945c8cb05f Mon Sep 17 00:00:00 2001 From: Arnaud Vergnet Date: Mon, 20 Apr 2020 12:28:25 +0200 Subject: [PATCH] Fixed app failing to load in apk format --- App.js | 41 +++++++++++++---------------------------- 1 file changed, 13 insertions(+), 28 deletions(-) diff --git a/App.js b/App.js index 4c9703e..e732314 100644 --- a/App.js +++ b/App.js @@ -1,11 +1,11 @@ // @flow import * as React from 'react'; -import {Platform, StatusBar, View, YellowBox} from 'react-native'; +import {Platform, StatusBar, YellowBox} from 'react-native'; import LocaleManager from './src/managers/LocaleManager'; import AsyncStorageManager from "./src/managers/AsyncStorageManager"; import CustomIntroSlider from "./src/components/Overrides/CustomIntroSlider"; -import {SplashScreen} from 'expo'; +import {AppLoading} from 'expo'; import type {CustomTheme} from "./src/managers/ThemeManager"; import ThemeManager from './src/managers/ThemeManager'; import {NavigationContainer} from '@react-navigation/native'; @@ -18,7 +18,6 @@ import Update from "./src/constants/Update"; import ConnectionManager from "./src/managers/ConnectionManager"; import URLHandler from "./src/utils/URLHandler"; import {setSafeBounceHeight} from "react-navigation-collapsible"; -import * as Animatable from 'react-native-animatable'; YellowBox.ignoreWarnings([ // collapsible headers cause this warning, just ignore as it is not an issue 'Non-serializable values were found in the navigation state', @@ -59,7 +58,7 @@ export default class App extends React.Component { constructor() { super(); LocaleManager.initTranslations(); - SplashScreen.preventAutoHide(); + // SplashScreen.preventAutoHide(); this.navigatorRef = React.createRef(); this.defaultHomeRoute = null; this.defaultHomeData = {}; @@ -145,7 +144,7 @@ export default class App extends React.Component { * * @returns {Promise} */ - async loadAssetsAsync() { + loadAssetsAsync = async () => { await this.storageManager.loadPreferences(); await initExpoToken(); try { @@ -161,7 +160,8 @@ export default class App extends React.Component { // Only show intro if this is the first time starting the app this.createDrawerNavigator = () => ; + defaultHomeData={this.defaultHomeData} + />; ThemeManager.getInstance().setUpdateThemeCallback(this.onUpdateTheme); // Status bar goes dark if set too fast on ios if (Platform.OS === 'ios') @@ -175,6 +175,7 @@ export default class App extends React.Component { showUpdate: this.storageManager.preferences.updateNumber.current !== Update.number.toString(), showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled() && this.storageManager.preferences.showAprilFoolsStart.current === '1', }); + // SplashScreen.hide(); } /** @@ -182,7 +183,7 @@ export default class App extends React.Component { */ render() { if (this.state.isLoading) { - return null; + return ; } else if (this.state.showIntro || this.state.showUpdate || this.state.showAprilFools) { return { } else { return ( - - { - // delay the hiding even 1ms is enough to prevent flickering - setTimeout(() => SplashScreen.hide(), 1); - }} - > - - - - - - - + + + + + ); }