-
Notifications
You must be signed in to change notification settings - Fork 0
/
HomeTabs.js
88 lines (80 loc) · 2.55 KB
/
HomeTabs.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { LinearGradient } from 'expo-linear-gradient';
import { useTheme } from '@react-navigation/native';
import { View, StyleSheet } from 'react-native';
import { Feather } from '@expo/vector-icons';
import { tabBarHeight } from './constants/sizes';
import Home from './screens/home/HomeScreen';
import Community from './screens/community/CommunityScreen';
import Resources from './screens/resources/ResourcesScreen';
import Settings from './screens/SettingsScreen';
const Tabs = createBottomTabNavigator();
const HomeTabs = () => {
const theme = useTheme();
const styles = StyleSheet.create({
tabBar: {
position: 'absolute',
backgroundColor: 'transparent',
borderTopColor: 'transparent',
height: tabBarHeight,
elevation: 0,
},
tabBarBackground: {
height: '100%',
},
});
return (
<Tabs.Navigator
screenOptions={({ route }) => ({
headerShown: false,
tabBarShowLabel: false,
tabBarStyle: styles.tabBar,
tabBarBackground: () => (
<View>
<LinearGradient
style={styles.tabBarBackground}
colors={[
theme.colors.primary + 'FF',
theme.colors.primary + '66',
theme.colors.primary + '00',
]}
locations={[0, 0.7, 1]}
start={{ x: 0, y: 1 }}
end={{ x: 0, y: 0 }}
/>
</View>
),
tabBarActiveTintColor: theme.colors.onPrimary,
tabBarInactiveTintColor: theme.dark
? 'rgb(150, 150, 150)'
: 'rgb(200, 200, 200)',
tabBarIcon: ({ color }) => {
let iconName;
switch (route.name) {
case 'Home':
iconName = 'home';
break;
case 'Community':
iconName = 'users';
break;
case 'Resources':
iconName = 'book-open';
break;
case 'Settings':
iconName = 'settings';
break;
default:
throw new Error('Not a valid route name');
}
return <Feather name={iconName} size={32} color={color} />;
},
})}
>
<Tabs.Screen name="Home" component={Home} />
<Tabs.Screen name="Community" component={Community} />
<Tabs.Screen name="Resources" component={Resources} />
<Tabs.Screen name="Settings" component={Settings} />
</Tabs.Navigator>
);
};
export default HomeTabs;