-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRoot.jsx
62 lines (58 loc) · 2.33 KB
/
Root.jsx
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
import * as React from 'react';
import Ionicons from 'react-native-vector-icons/Ionicons';
import { FontAwesome5 } from '@expo/vector-icons';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import CalendarView from './components/Calendar/CalendarView';
import Home from './components/Home/Home';
import Profile from './components/Profile/Profile';
import Workouts from './components/Workouts/Workouts';
import Cycles from './components/Cycles/Cycles';
import { Entypo } from '@expo/vector-icons';
import { COLORS } from './constants';
import { useSelector } from 'react-redux';
export default ({ navigation }) => {
const Tab = createBottomTabNavigator();
const colorTheme = useSelector((state) => state.settings.colorTheme);
return (
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ color, size }) => {
// Returns the icon for each tab
let icon;
if (route.name === 'Home') {
icon = <Ionicons name="ios-home" size={size} color={color} />;
} else if (route.name === 'Workouts') {
icon = (
<FontAwesome5 name="dumbbell" size={size} color={color} />
);
} else if (route.name === 'Calendar') {
icon = (
<Ionicons name="ios-calendar" size={size} color={color} />
);
} else if (route.name === 'Profile') {
icon = (
<FontAwesome5
name="user-circle"
size={size}
color={color}
/>
);
} else if (route.name === 'Cycles') {
icon = <Entypo name="cycle" size={size} color={color} />;
}
return icon;
},
})}
tabBarOptions={{
activeTintColor: COLORS[colorTheme][1],
inactiveTintColor: 'gray',
}}
>
<Tab.Screen name="Home" component={Home} />
<Tab.Screen name="Workouts" component={Workouts} />
<Tab.Screen name="Cycles" component={Cycles} />
<Tab.Screen name="Calendar" component={CalendarView} />
<Tab.Screen name="Profile" component={Profile} />
</Tab.Navigator>
);
};