This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
App.js
72 lines (62 loc) · 2.02 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/**
* @author Arthur Martello <arthur.martello@etu.utc.fr>
* @author Samy Nastuzzi <samy@nastuzzi.fr>
*
* @copyright Copyright (c) 2019, SiMDE-UTC
* @license GPL-3.0
*/
import React from 'react';
import { StatusBar, YellowBox, StyleSheet, Text, Platform } from 'react-native';
import { createAppContainer, createSwitchNavigator, SafeAreaView } from 'react-navigation';
import { Provider, connect } from 'react-redux';
import SpinnerOverlay from 'react-native-loading-spinner-overlay';
import AppLoader from './src/screens/AppLoader';
import ChangelogScreen from './src/screens/Settings/ChangelogScreen';
import MainNavigator from './src/navigations/MainNavigator';
import AuthNavigator from './src/navigations/Auth/AuthNavigator';
import store from './src/redux/store';
import colors from './src/styles/colors';
const styles = StyleSheet.create({
defaultFontFamily: {
fontFamily: 'Roboto',
},
});
// Bug: https://github.com/simde-utc/payutc-mobile/issues/226
if (Platform.OS === 'android') {
const oldRender = Text.render;
Text.render = function render(...args) {
const origin = oldRender.call(this, ...args);
return React.cloneElement(origin, {
style: [styles.defaultFontFamily, origin.props.style],
});
};
}
const AppNavigator = createSwitchNavigator(
{
Loading: AppLoader,
Auth: AuthNavigator,
Main: MainNavigator,
Changelog: ChangelogScreen,
},
{
initialRouteName: 'Loading',
}
);
YellowBox.ignoreWarnings(['Async Storage', 'WebView']);
const AppContainer = createAppContainer(AppNavigator);
const paddingTop = StatusBar.currentHeight || 20;
const mapStateToProps = ({ config }) => ({ config });
const ConnectedApp = connect(mapStateToProps)(({ config }) => (
<SafeAreaView style={{ flex: 1, paddingTop }} forceInset={{ bottom: 'never' }}>
<StatusBar backgroundColor={colors.primary} translucent />
<SpinnerOverlay {...config.spinner} />
<AppContainer screenProps={{ config }} />
</SafeAreaView>
));
export default function App() {
return (
<Provider store={store}>
<ConnectedApp />
</Provider>
);
}