forked from vergnet/application-amicale
Fixed app failing to load in apk format
This commit is contained in:
parent
a3a1b2e29c
commit
f0772dff38
1 changed files with 13 additions and 28 deletions
41
App.js
41
App.js
|
@ -1,11 +1,11 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
import * as React from 'react';
|
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 LocaleManager from './src/managers/LocaleManager';
|
||||||
import AsyncStorageManager from "./src/managers/AsyncStorageManager";
|
import AsyncStorageManager from "./src/managers/AsyncStorageManager";
|
||||||
import CustomIntroSlider from "./src/components/Overrides/CustomIntroSlider";
|
import CustomIntroSlider from "./src/components/Overrides/CustomIntroSlider";
|
||||||
import {SplashScreen} from 'expo';
|
import {AppLoading} from 'expo';
|
||||||
import type {CustomTheme} from "./src/managers/ThemeManager";
|
import type {CustomTheme} from "./src/managers/ThemeManager";
|
||||||
import ThemeManager from './src/managers/ThemeManager';
|
import ThemeManager from './src/managers/ThemeManager';
|
||||||
import {NavigationContainer} from '@react-navigation/native';
|
import {NavigationContainer} from '@react-navigation/native';
|
||||||
|
@ -18,7 +18,6 @@ import Update from "./src/constants/Update";
|
||||||
import ConnectionManager from "./src/managers/ConnectionManager";
|
import ConnectionManager from "./src/managers/ConnectionManager";
|
||||||
import URLHandler from "./src/utils/URLHandler";
|
import URLHandler from "./src/utils/URLHandler";
|
||||||
import {setSafeBounceHeight} from "react-navigation-collapsible";
|
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
|
YellowBox.ignoreWarnings([ // collapsible headers cause this warning, just ignore as it is not an issue
|
||||||
'Non-serializable values were found in the navigation state',
|
'Non-serializable values were found in the navigation state',
|
||||||
|
@ -59,7 +58,7 @@ export default class App extends React.Component<Props, State> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super();
|
super();
|
||||||
LocaleManager.initTranslations();
|
LocaleManager.initTranslations();
|
||||||
SplashScreen.preventAutoHide();
|
// SplashScreen.preventAutoHide();
|
||||||
this.navigatorRef = React.createRef();
|
this.navigatorRef = React.createRef();
|
||||||
this.defaultHomeRoute = null;
|
this.defaultHomeRoute = null;
|
||||||
this.defaultHomeData = {};
|
this.defaultHomeData = {};
|
||||||
|
@ -145,7 +144,7 @@ export default class App extends React.Component<Props, State> {
|
||||||
*
|
*
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
async loadAssetsAsync() {
|
loadAssetsAsync = async () => {
|
||||||
await this.storageManager.loadPreferences();
|
await this.storageManager.loadPreferences();
|
||||||
await initExpoToken();
|
await initExpoToken();
|
||||||
try {
|
try {
|
||||||
|
@ -161,7 +160,8 @@ export default class App extends React.Component<Props, State> {
|
||||||
// Only show intro if this is the first time starting the app
|
// Only show intro if this is the first time starting the app
|
||||||
this.createDrawerNavigator = () => <DrawerNavigator
|
this.createDrawerNavigator = () => <DrawerNavigator
|
||||||
defaultHomeRoute={this.defaultHomeRoute}
|
defaultHomeRoute={this.defaultHomeRoute}
|
||||||
defaultHomeData={this.defaultHomeData}/>;
|
defaultHomeData={this.defaultHomeData}
|
||||||
|
/>;
|
||||||
ThemeManager.getInstance().setUpdateThemeCallback(this.onUpdateTheme);
|
ThemeManager.getInstance().setUpdateThemeCallback(this.onUpdateTheme);
|
||||||
// Status bar goes dark if set too fast on ios
|
// Status bar goes dark if set too fast on ios
|
||||||
if (Platform.OS === 'ios')
|
if (Platform.OS === 'ios')
|
||||||
|
@ -175,6 +175,7 @@ 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();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -182,7 +183,7 @@ export default class App extends React.Component<Props, State> {
|
||||||
*/
|
*/
|
||||||
render() {
|
render() {
|
||||||
if (this.state.isLoading) {
|
if (this.state.isLoading) {
|
||||||
return null;
|
return <AppLoading/>;
|
||||||
} else if (this.state.showIntro || this.state.showUpdate || this.state.showAprilFools) {
|
} else if (this.state.showIntro || this.state.showUpdate || this.state.showAprilFools) {
|
||||||
return <CustomIntroSlider
|
return <CustomIntroSlider
|
||||||
onDone={this.onIntroDone}
|
onDone={this.onIntroDone}
|
||||||
|
@ -192,27 +193,11 @@ export default class App extends React.Component<Props, State> {
|
||||||
} else {
|
} else {
|
||||||
return (
|
return (
|
||||||
<PaperProvider theme={this.state.currentTheme}>
|
<PaperProvider theme={this.state.currentTheme}>
|
||||||
<View style={{
|
<NavigationContainer theme={this.state.currentTheme} ref={this.navigatorRef}>
|
||||||
flex: 1,
|
<Stack.Navigator headerMode="none">
|
||||||
backgroundColor: ThemeManager.getCurrentTheme().colors.background
|
<Stack.Screen name="Root" component={this.createDrawerNavigator}/>
|
||||||
}}>
|
</Stack.Navigator>
|
||||||
<Animatable.View
|
</NavigationContainer>
|
||||||
style={{flex: 1,}}
|
|
||||||
animation={"fadeIn"}
|
|
||||||
duration={1000}
|
|
||||||
useNativeDriver
|
|
||||||
onAnimationBegin={() => {
|
|
||||||
// delay the hiding even 1ms is enough to prevent flickering
|
|
||||||
setTimeout(() => SplashScreen.hide(), 1);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<NavigationContainer theme={this.state.currentTheme} ref={this.navigatorRef}>
|
|
||||||
<Stack.Navigator headerMode="none">
|
|
||||||
<Stack.Screen name="Root" component={this.createDrawerNavigator}/>
|
|
||||||
</Stack.Navigator>
|
|
||||||
</NavigationContainer>
|
|
||||||
</Animatable.View>
|
|
||||||
</View>
|
|
||||||
</PaperProvider>
|
</PaperProvider>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue