forked from Suhadmendis/react-native-rent-a-car
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
95 lines (82 loc) · 2.95 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { StatusBar } from "expo-status-bar";
import { Image, StyleSheet, Text, View } from "react-native";
import HomeScreen from "./src/HomeScreen";
import MapScreen from "./src/MapScreen";
import SettingsScreen from "./src/SettingsScreen";
import SavedScreen from "./src/SavedScreen";
import InfoScreen from "./src/InfoScreen";
const homeIcon_active = require("./src/assets/icons/home-active.png");
const homeIcon = require("./src/assets/icons/home.png");
const compass_active = require("./src/assets/icons/compass-active.png");
const compass = require("./src/assets/icons/compass.png");
const savedIcon_active = require("./src/assets/icons/saved-active.png");
const savedIcon = require("./src/assets/icons/saved.png");
const settingsIcon_active = require("./src/assets/icons/settings-active.png");
const settingsIcon = require("./src/assets/icons/settings.png");
const Stack = createNativeStackNavigator();
const Tab = createBottomTabNavigator();
function HomeStack() {
return (
<Stack.Navigator
screenOptions={{
headerShown: false
}}
>
<Stack.Screen name="Initial" component={HomeScreen} />
<Stack.Screen name="Info" component={InfoScreen} />
</Stack.Navigator>
)
}
export default function App() {
return (
<NavigationContainer>
<Tab.Navigator
screenOptions={({ route }) => ({
headerShown: false,
tabBarIcon: ({ focused }) => {
let iconName;
if (route.name === "Home") {
iconName = focused ? homeIcon_active : homeIcon;
} else if (route.name === "Map") {
iconName = focused ? compass_active : compass;
} else if (route.name === "Saved") {
iconName = focused ? savedIcon_active : savedIcon;
} else if (route.name === "Settings") {
iconName = focused ? settingsIcon_active : settingsIcon;
}
return (
<Image source={iconName} resizeMode="contain" style={styles.footerIcon} />
)
},
tabBarShowLabel: false,
tabBarStyle: {
position: "absolute",
padding: 10,
backgroundColor: 'black',
borderTopStartRadius: 40,
borderTopEndRadius: 40,
}
})}
>
<Tab.Screen name="Home" component={HomeStack} />
<Tab.Screen name="Map" component={MapScreen} />
<Tab.Screen name="Saved" component={SavedScreen} />
<Tab.Screen name="Settings" component={SettingsScreen} />
</Tab.Navigator>
</NavigationContainer>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
footerIcon: {
width: 25
}
});