-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
95 lines (85 loc) · 3.3 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
import * as React from 'react';
import { useColorScheme } from 'react-native';
import { QueryClient, QueryClientProvider } from 'react-query';
import * as Localization from 'expo-localization';
import i18n from 'i18n-js';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { Ionicons, AntDesign } from '@expo/vector-icons';
import { NavigationContainer } from '@react-navigation/native';
import * as EN_USD_TRANSLATIONS from './translations/en-US.json';
import * as LT_LT_TRANSLATIONS from './translations/lt-LT.json';
import { HomeScreen } from './screens/Home.screen';
import { TodoListScreen } from './screens/TodoList.screen';
import { TodoFormScreen } from './screens/TodoForm.screen';
import { PushNotificationScreen } from './screens/PushNotification.screen';
import { colors } from './styles';
// Set the key-value pairs for the different languages you want to support.
i18n.translations = {
'en-US': EN_USD_TRANSLATIONS,
'lt-LT': LT_LT_TRANSLATIONS,
};
// Set the locale once at the beginning of your app.
i18n.locale = Localization.locale;
i18n.fallbacks = true;
const queryClient = new QueryClient();
const Tab = createBottomTabNavigator();
export default function App() {
const colorScheme = useColorScheme();
return (
<QueryClientProvider client={queryClient}>
<NavigationContainer>
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ color, size }) => {
switch (route.name) {
case i18n.t('home', { defaultValue: 'Home' }):
return <Ionicons name={'home'} size={size} color={color} />;
case i18n.t('todoList', { defaultValue: 'Todo list' }):
return <Ionicons name={'list'} size={size} color={color} />;
case i18n.t('todoForm', { defaultValue: 'Todo form' }):
return <AntDesign name={'form'} size={size} color={color} />;
case i18n.t('notification', { defaultValue: 'Notification' }):
return (
<AntDesign
name={'notification'}
size={size}
color={color}
/>
);
default:
return (
<Ionicons name={undefined} size={size} color={color} />
);
}
},
})}
tabBarOptions={{
activeTintColor: colors.primary.default,
inactiveTintColor: colors.gray,
style: {
backgroundColor:
colorScheme === 'light' ? colors.light : colors.dark,
},
}}
>
<Tab.Screen
name={i18n.t('home', { defaultValue: 'Home' })}
component={HomeScreen}
/>
<Tab.Screen
name={i18n.t('todoList', { defaultValue: 'Todo list' })}
component={TodoListScreen}
/>
<Tab.Screen
name={i18n.t('todoForm', { defaultValue: 'Todo form' })}
component={TodoFormScreen}
/>
<Tab.Screen
name={i18n.t('notification', { defaultValue: 'Notification' })}
component={PushNotificationScreen}
/>
</Tab.Navigator>
</NavigationContainer>
</QueryClientProvider>
);
}