-
Notifications
You must be signed in to change notification settings - Fork 97
/
Tab.tsx
executable file
·39 lines (36 loc) · 1.33 KB
/
Tab.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
import React from 'react';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { AntDesign } from '@expo/vector-icons';
import { colors } from '@/theme';
import { TabParamList, TabBarStatus } from './Tab.typeDefs';
import { HomeStackNavigator, ProfileStackNavigator } from '../stack/Stack';
const Tab = createBottomTabNavigator<TabParamList>();
const renderTabBarIcon = (tabName: keyof TabParamList) => (tabStatus: TabBarStatus) => {
switch (tabName) {
case 'HomeTab':
return <AntDesign name="home" size={24} color={tabStatus.color} />;
case 'ProfileTab':
return <AntDesign name="profile" size={24} color={tabStatus.color} />;
// add more...
}
};
export default function TabNavigator() {
return (
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: renderTabBarIcon(route.name),
headerShown: false,
tabBarInactiveTintColor: colors.gray,
tabBarInactiveBackgroundColor: colors.white,
tabBarActiveTintColor: colors.lightPurple,
tabBarActiveBackgroundColor: colors.white,
})}>
<Tab.Screen name="HomeTab" component={HomeStackNavigator} options={{ title: 'Home' }} />
<Tab.Screen
name="ProfileTab"
component={ProfileStackNavigator}
options={{ title: 'Profile' }}
/>
</Tab.Navigator>
);
}