This repository has been archived by the owner on Jan 5, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
73 lines (63 loc) · 1.92 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
import 'react-native-get-random-values';
import 'intl';
try {
(Intl as any).__disableRegExpRestore();
} catch (error) {
// Ignore, it's only used in Android
}
import 'intl/locale-data/jsonp/en';
import React from 'react';
import { createAppContainer } from 'react-navigation';
import { createBottomTabNavigator } from 'react-navigation-tabs';
import { Ionicons } from '@expo/vector-icons';
import { RxDatabase } from 'rxdb';
import { withLayout } from './hocs';
import SettingsPage from './pages/settings';
import BudgetsPage from './pages/budgets';
import ExpensesPage from './pages/expenses';
import AddPage from './pages/add';
const db: RxDatabase = null;
const sharedOptions = { db };
type IconType =
| 'ios-add-circle'
| 'ios-albums'
| 'ios-layers'
| 'ios-settings-sharp';
const TabNavigator = createBottomTabNavigator(
{
Settings: withLayout(SettingsPage, sharedOptions),
Budgets: withLayout(BudgetsPage, sharedOptions),
Expenses: withLayout(ExpensesPage, sharedOptions),
Add: withLayout(AddPage, sharedOptions),
},
{
initialRouteName: 'Add',
defaultNavigationOptions: ({ navigation }) => ({
// eslint-disable-next-line
tabBarIcon: ({ tintColor }) => {
const { routeName } = navigation.state;
let iconName: IconType;
if (routeName === 'Add') {
iconName = 'ios-add-circle';
} else if (routeName === 'Expenses') {
iconName = 'ios-albums';
} else if (routeName === 'Budgets') {
iconName = 'ios-layers';
} else if (routeName === 'Settings') {
iconName = 'ios-settings-sharp';
}
return <Ionicons name={iconName} size={30} color={tintColor} />;
},
}),
tabBarOptions: {
activeTintColor: '#80A881',
inactiveTintColor: 'gray',
showLabel: false,
style: {
paddingTop: 8,
},
},
},
);
const App = createAppContainer(TabNavigator);
export default App;