-
Notifications
You must be signed in to change notification settings - Fork 2
/
AppNavigator.js
49 lines (41 loc) · 1.54 KB
/
AppNavigator.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
import React from 'react';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { Ionicons } from '@expo/vector-icons'; // Import Ionicons
import HomeScreen from './screens/HomeScreen';
import VehicleListScreen from './screens/VehicleListScreen';
import AddEditVehicleScreen from './screens/AddEditVehicleScreen';
import VehicleDetailsScreen from './screens/VehicleDetailsScreen';
const Tab = createBottomTabNavigator();
const AppNavigator = () => {
return (
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ focused, color, size }) => {
let iconName;
if (route.name === 'Home') {
iconName = focused ? 'home' : 'home-outline';
} else if (route.name === 'VehicleList') {
iconName = focused ? 'car' : 'car-outline';
} else if (route.name === 'AddEditVehicle') {
iconName = focused ? 'add' : 'add-outline';
}
// Return the appropriate icon component
return <Ionicons name={iconName} size={size} color={color} />;
},
})}
tabBarOptions={{
activeTintColor: 'tomato',
inactiveTintColor: 'gray',
}}
tabBarStyle={{
display: 'flex',
}}
>
<Tab.Screen name="Home" component={HomeScreen} />
<Tab.Screen name="VehicleList" component={VehicleListScreen} />
<Tab.Screen name="AddEditVehicle" component={AddEditVehicleScreen} />
{/* ... add other screens */}
</Tab.Navigator>
);
};
export default AppNavigator;