-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
42 lines (38 loc) · 1.52 KB
/
App.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
import * as React from "react";
import { Text, View } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import HomeScreen from "./screens/HomeScreen";
import EventsScreen from "./screens/EventsScreen";
import ContactScreen from "./screens/ContactScreen";
import { FontAwesome } from "@expo/vector-icons";
const Tab = createBottomTabNavigator();
export default function App() {
return (
<NavigationContainer>
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ focused, color, size }) => {
let iconName;
//Set the icon based on which route it is (name of the tab)
if (route.name === "Home") {
iconName = "home";
} else if (route.name === "Events") {
iconName = "list";
} else if (route.name === "Contact") {
iconName = focused ? "user" : "user-o";
}
// You can return any component that you like here!
return <FontAwesome name={iconName} size={size} color={color} />;
},
tabBarActiveTintColor: "tomato",
tabBarInactiveTintColor: "gray",
})}
>
<Tab.Screen name="Home" component={HomeScreen} />
<Tab.Screen name="Events" options={{ headerShown: false }} component={EventsScreen} />
<Tab.Screen name="Contact" component={ContactScreen} />
</Tab.Navigator>
</NavigationContainer>
);
}