-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
55 lines (50 loc) · 2.01 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
43
44
45
46
47
48
49
50
51
52
53
54
55
import React from "react";
import { StyleSheet, Text, View } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { Feather } from "@expo/vector-icons";
import ScreenOne from "./src/screens/ScreenOne";
import ScreenThree from "./src/screens/ScreenThree";
const Tab = createBottomTabNavigator();
export default function App() {
return (
<NavigationContainer>
<Tab.Navigator
initialRouteName="Screen Two" //Change to default page. This is probably self evident but wanted to make sure people didn't miss it.
screenOptions={({ route }) => ({
tabBarIcon: ({ focused, color, size }) => {
// Get icons from https://expo.github.io/vector-icons/ Look for Icons from the feather pack as that's what I'm using
let iconName;
if (route.name === "Screen One") {
iconName = "settings";
} else if (route.name === "GPS Tracking") {
iconName = "map-pin";
// iconName = focused ? 'home' : 'anchor' // Use to change icon depending if that screen is currently selected or not
} else if (route.name === "Code") {
iconName = "github";
}
// You can return any component that you like here
return <Feather name={iconName} size={size} color={color} />;
},
})}
tabBarOptions={{
// Changes the color of tabs depending if they're active or not
activeTintColor: "tomato",
inactiveTintColor: "gray",
}}
>
{/* <Tab.Screen name="Screen One" component={ScreenOne} /> */}
<Tab.Screen name="GPS Tracking" component={ScreenOne} />
<Tab.Screen name="Code" component={ScreenThree} />
</Tab.Navigator>
</NavigationContainer>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});