import React from 'react'; import { TouchableOpacity } from 'react-native'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; import { DrawerNavigationProp } from '@react-navigation/drawer'; import Icon from 'react-native-vector-icons/Ionicons'; import { route, RouteParams } from '@utils'; import { DashboardScreen, AddLeadScreen, CustomersScreen, ProfileScreen, } from '@features'; import { LeadsStack } from './leadsStack'; import { useTheme } from '@theme'; import { getStyles } from './tabStack.styles'; export type TabStackParamList = Pick< RouteParams, 'dashboard' | 'leads' | 'addLead' | 'customers' | 'profile' >; const Tab = createBottomTabNavigator(); export const TabStack = () => { const { theme: colors } = useTheme(); const styles = getStyles(colors); return ( ({ tabBarIcon: ({ focused, color, size }) => { let iconName = 'square'; if (tabRoute.name === route.dashboard) { iconName = focused ? 'grid' : 'grid-outline'; } else if (tabRoute.name === route.leads) { iconName = focused ? 'funnel' : 'funnel-outline'; } else if (tabRoute.name === route.addLead) { iconName = focused ? 'add-circle' : 'add-circle-outline'; } else if (tabRoute.name === route.customers) { iconName = focused ? 'business' : 'business-outline'; } else if (tabRoute.name === route.profile) { iconName = focused ? 'person' : 'person-outline'; } return ; }, tabBarActiveTintColor: colors.icon, tabBarInactiveTintColor: colors.textMuted, tabBarStyle: styles.tabBar, tabBarLabelStyle: styles.tabBarLabel, headerStyle: styles.header, headerTitleStyle: styles.headerTitle, headerTitleAlign: 'center', })} > ({ headerTitle: 'Convex CRM', headerLeft: () => ( { const parentNav = navigation.getParent>(); if (parentNav) { parentNav.openDrawer(); } else { (navigation as any).openDrawer?.(); } }} > ), })} /> ); };