-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathApp.js
More file actions
84 lines (77 loc) · 2.32 KB
/
App.js
File metadata and controls
84 lines (77 loc) · 2.32 KB
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
import React from "react";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { Ionicons } from "@expo/vector-icons";
import { Colors, Styles } from "./src/constants";
import Explore from "./src/screens/Explore";
import AllMessages from "./src/screens/AllMessages";
import Profile from "./src/screens/Profile";
import UserProfile from "./src/screens/UserProfile";
import Chat from "./src/screens/Chat";
function getTabIcon(routeName) {
switch (routeName) {
case "Explore":
return "ios-beer";
case "Messages":
return "ios-chatbubbles";
case "Profile":
return "ios-person";
}
}
const Tab = createBottomTabNavigator();
function HomeTabScreen() {
return (
<Tab.Navigator
screenOptions={(options) => ({
...Styles.Header,
...Styles.Tabs,
tabBarIcon: ({ color }) => (
<Ionicons
name={getTabIcon(options.route.name)}
size={32}
color={color}
style={{ marginTop: 2 }}
/>
),
})}
>
<Tab.Screen name="Explore" component={Explore} options={{}} />
<Tab.Screen name="Messages" component={AllMessages} />
<Tab.Screen name="Profile" component={Profile} />
</Tab.Navigator>
);
}
const MainStack = createNativeStackNavigator();
function MainStackScreen() {
return (
<MainStack.Navigator
screenOptions={{
...Styles.Header,
headerShown: false,
}}
>
<MainStack.Screen name="Home" component={HomeTabScreen} />
<MainStack.Screen
name="Chat"
component={Chat}
options={{ headerShown: true }}
/>
</MainStack.Navigator>
);
}
const AppStack = createNativeStackNavigator();
export default function App() {
return (
<NavigationContainer>
<AppStack.Navigator screenOptions={{ headerShown: false }}>
<AppStack.Group>
<AppStack.Screen name="Main" component={MainStackScreen} />
</AppStack.Group>
<AppStack.Group screenOptions={{ presentation: "modal" }}>
<AppStack.Screen name="UserProfile" component={UserProfile} />
</AppStack.Group>
</AppStack.Navigator>
</NavigationContainer>
);
}