Browse Source

Fixed app failing to load in apk format

Arnaud Vergnet 4 years ago
parent
commit
f0772dff38
1 changed files with 13 additions and 28 deletions
  1. 13
    28
      App.js

+ 13
- 28
App.js View File

@@ -1,11 +1,11 @@
1 1
 // @flow
2 2
 
3 3
 import * as React from 'react';
4
-import {Platform, StatusBar, View, YellowBox} from 'react-native';
4
+import {Platform, StatusBar, YellowBox} from 'react-native';
5 5
 import LocaleManager from './src/managers/LocaleManager';
6 6
 import AsyncStorageManager from "./src/managers/AsyncStorageManager";
7 7
 import CustomIntroSlider from "./src/components/Overrides/CustomIntroSlider";
8
-import {SplashScreen} from 'expo';
8
+import {AppLoading} from 'expo';
9 9
 import type {CustomTheme} from "./src/managers/ThemeManager";
10 10
 import ThemeManager from './src/managers/ThemeManager';
11 11
 import {NavigationContainer} from '@react-navigation/native';
@@ -18,7 +18,6 @@ import Update from "./src/constants/Update";
18 18
 import ConnectionManager from "./src/managers/ConnectionManager";
19 19
 import URLHandler from "./src/utils/URLHandler";
20 20
 import {setSafeBounceHeight} from "react-navigation-collapsible";
21
-import * as Animatable from 'react-native-animatable';
22 21
 
23 22
 YellowBox.ignoreWarnings([ // collapsible headers cause this warning, just ignore as it is not an issue
24 23
     'Non-serializable values were found in the navigation state',
@@ -59,7 +58,7 @@ export default class App extends React.Component<Props, State> {
59 58
     constructor() {
60 59
         super();
61 60
         LocaleManager.initTranslations();
62
-        SplashScreen.preventAutoHide();
61
+        // SplashScreen.preventAutoHide();
63 62
         this.navigatorRef = React.createRef();
64 63
         this.defaultHomeRoute = null;
65 64
         this.defaultHomeData = {};
@@ -145,7 +144,7 @@ export default class App extends React.Component<Props, State> {
145 144
      *
146 145
      * @returns {Promise<void>}
147 146
      */
148
-    async loadAssetsAsync() {
147
+    loadAssetsAsync = async () => {
149 148
         await this.storageManager.loadPreferences();
150 149
         await initExpoToken();
151 150
         try {
@@ -161,7 +160,8 @@ export default class App extends React.Component<Props, State> {
161 160
         // Only show intro if this is the first time starting the app
162 161
         this.createDrawerNavigator = () => <DrawerNavigator
163 162
             defaultHomeRoute={this.defaultHomeRoute}
164
-            defaultHomeData={this.defaultHomeData}/>;
163
+            defaultHomeData={this.defaultHomeData}
164
+        />;
165 165
         ThemeManager.getInstance().setUpdateThemeCallback(this.onUpdateTheme);
166 166
         // Status bar goes dark if set too fast on ios
167 167
         if (Platform.OS === 'ios')
@@ -175,6 +175,7 @@ export default class App extends React.Component<Props, State> {
175 175
             showUpdate: this.storageManager.preferences.updateNumber.current !== Update.number.toString(),
176 176
             showAprilFools: AprilFoolsManager.getInstance().isAprilFoolsEnabled() && this.storageManager.preferences.showAprilFoolsStart.current === '1',
177 177
         });
178
+        // SplashScreen.hide();
178 179
     }
179 180
 
180 181
     /**
@@ -182,7 +183,7 @@ export default class App extends React.Component<Props, State> {
182 183
      */
183 184
     render() {
184 185
         if (this.state.isLoading) {
185
-            return null;
186
+            return <AppLoading/>;
186 187
         } else if (this.state.showIntro || this.state.showUpdate || this.state.showAprilFools) {
187 188
             return <CustomIntroSlider
188 189
                 onDone={this.onIntroDone}
@@ -192,27 +193,11 @@ export default class App extends React.Component<Props, State> {
192 193
         } else {
193 194
             return (
194 195
                 <PaperProvider theme={this.state.currentTheme}>
195
-                    <View style={{
196
-                        flex: 1,
197
-                        backgroundColor: ThemeManager.getCurrentTheme().colors.background
198
-                    }}>
199
-                        <Animatable.View
200
-                            style={{flex: 1,}}
201
-                            animation={"fadeIn"}
202
-                            duration={1000}
203
-                            useNativeDriver
204
-                            onAnimationBegin={() => {
205
-                                // delay the hiding even 1ms is enough to prevent flickering
206
-                                setTimeout(() => SplashScreen.hide(), 1);
207
-                            }}
208
-                        >
209
-                            <NavigationContainer theme={this.state.currentTheme} ref={this.navigatorRef}>
210
-                                <Stack.Navigator headerMode="none">
211
-                                    <Stack.Screen name="Root" component={this.createDrawerNavigator}/>
212
-                                </Stack.Navigator>
213
-                            </NavigationContainer>
214
-                        </Animatable.View>
215
-                    </View>
196
+                    <NavigationContainer theme={this.state.currentTheme} ref={this.navigatorRef}>
197
+                        <Stack.Navigator headerMode="none">
198
+                            <Stack.Screen name="Root" component={this.createDrawerNavigator}/>
199
+                        </Stack.Navigator>
200
+                    </NavigationContainer>
216 201
                 </PaperProvider>
217 202
             );
218 203
         }

Loading…
Cancel
Save