This repository has been archived by the owner on Feb 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.tsx
172 lines (164 loc) · 5 KB
/
App.tsx
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* Generated with the TypeScript template
* https://github.com/react-native-community/react-native-template-typescript
*
* @format
*/
import React from 'react';
import { Platform } from 'react-native';
import {
SafeAreaProvider,
SafeAreaInsetsContext,
} from 'react-native-safe-area-context';
import {NavigationContainer} from '@react-navigation/native';
import MovaTheme from './src/constants/MovaTheme';
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs';
import {useTranslation} from 'react-i18next';
import RadioMain from './src/components/radio/RadioMain';
import NewsMain from './src/components/news/NewsMain';
import './src/i18n';
import MovaIcon from './src/components/generic/MovaIcon';
import moment from 'moment';
import 'moment/locale/de';
import 'moment/locale/fr';
import 'moment/locale/it';
import InfosMain from './src/components/infos/InfosMain';
import MapMain from './src/components/map/MapMain';
import languageManager from './src/helpers/LanguageManager';
import SplashScreen from 'react-native-splash-screen';
import Toast, { InfoToast, BaseToastProps, ErrorToast } from 'react-native-toast-message';
const Tab = createBottomTabNavigator();
// set moment language
moment.locale('de');
languageManager.applyLanguageFromStorageOrDevice();
const App = () => {
const {t} = useTranslation();
React.useEffect(() => {
setTimeout(() => SplashScreen.hide(), 1500);
});
return (
<SafeAreaProvider>
<SafeAreaInsetsContext.Consumer>
{(insets) => (
<>
<NavigationContainer>
<Tab.Navigator
tabBarOptions={{
allowFontScaling: false,
activeTintColor: MovaTheme.colorBlack,
inactiveTintColor: MovaTheme.colorGrey,
labelStyle: {
fontFamily:
Platform.OS === 'ios' ? 'MessinaSans-Bold' : 'MS-Bold',
fontSize: 16,
},
style: {
paddingTop: 5,
height: 70,
marginBottom: insets ? insets.bottom : 0,
borderTopColor: '#fff',
},
tabStyle: {
height: 60,
},
}}>
<Tab.Screen
name="news"
component={NewsMain}
options={{
tabBarLabel: t('news'),
tabBarIcon: ({focused, color, size}) => (
<MovaIcon
name={focused ? 'news' : 'news-outline'}
size={40}
color={color}
/>
),
}}
/>
<Tab.Screen
name="infos"
component={InfosMain}
options={{
tabBarLabel: t('info'),
tabBarIcon: ({focused, color, size}) => (
<MovaIcon
name={focused ? 'info' : 'info-outline'}
size={40}
color={color}
/>
),
}}
/>
<Tab.Screen
name="radio"
component={RadioMain}
options={{
tabBarLabel: t('radio'),
tabBarIcon: ({focused, color, size}) => (
<MovaIcon
name={focused ? 'radio' : 'radio-outline'}
size={40}
color={color}
/>
),
}}
/>
<Tab.Screen
name="map"
component={MapMain}
options={{
tabBarLabel: t('map'),
tabBarIcon: ({focused, color, size}) => (
<MovaIcon
name={focused ? 'map' : 'map-outline'}
size={40}
color={color}
/>
),
}}
/>
</Tab.Navigator>
</NavigationContainer>
<Toast config={toastConfig} />
</>
)}
</SafeAreaInsetsContext.Consumer>
</SafeAreaProvider>
);
};
export default App;
const fontFamily = Platform.OS === 'ios' ? 'MessinaSans-Bold' : 'MS-Bold';
const toastConfig = {
info: (props: BaseToastProps) => (
<InfoToast
{...props}
text1Style={{
fontFamily: fontFamily,
fontSize: 16
}}
text2Style={{
fontFamily: fontFamily,
fontSize: 15
}}
style={{ borderLeftColor: MovaTheme.colorBlue }}
/>
),
error: (props: BaseToastProps) => (
<ErrorToast
{...props}
text1Style={{
fontFamily: fontFamily,
fontSize: 16
}}
text2Style={{
fontFamily: fontFamily,
fontSize: 15
}}
style={{ borderLeftColor: MovaTheme.colorOrange }}
/>
)
};