-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
74 lines (51 loc) · 2.99 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
import React, { useState } from "react";
import { View, Text } from "react-native";
import { MaterialCommunityIcons } from "react-native-vector-icons";
import { NavigationContainer, useNavigation } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import TabNavigator from "./tabs/TabNavigator";
import Header from "./components/Header";
import * as constants from "./utils/constants";
import HomeScreen from "./screens/HomeScreen";
import ConsultScreen from "./screens/ConsultScreen";
import ProfileScreen from "./screens/ProfileScreen";
const Tab = createBottomTabNavigator();
const Stack = createNativeStackNavigator();
export default function App({navigation}) {
const [item, setItem] = useState("");
function assignItem(selected) {
setItem(selected);
}
const homeScreenSettings = {
tabBarLabel: ({ focused }) => <Text style={{color: focused ? constants.highlightBlue : "#000", fontSize: 10 }}>Home</Text>,
tabBarIcon: ({ focused }) => <MaterialCommunityIcons color={focused ? constants.highlightBlue : "#000"} name="home" size={25} />
};
const ConsultScreenSettings = {
tabBarBadge: 0,
tabBarBadgeStyle: { backgroundColor: constants.statusPink },
tabBarLabel: ({ focused }) => <Text style={{color: focused ? constants.highlightBlue : "#000", fontSize: 10 }}>Consults</Text>,
tabBarIcon: ({ focused }) => <MaterialCommunityIcons color={focused ? constants.highlightBlue : "#000"} name="message-reply" size={25} />
};
const ordersScreenSettings = {
tabBarBadge: 0,
tabBarBadgeStyle: { backgroundColor: constants.statusPink },
tabBarLabel: ({ focused }) => <Text style={{color: focused ? constants.highlightBlue : "#000", fontSize: 10 }}>Orders</Text>,
headerTitle: () => <Header itemHandler={assignItem} />,
tabBarIcon: ({ focused }) => <MaterialCommunityIcons color={focused ? constants.highlightBlue : "#000"} name="cart" size={25} />
};
const profileScreenSettings = {
tabBarLabel: ({ focused }) => <Text style={{color: focused ? constants.highlightBlue : "#000", fontSize: 10 }}>Profile</Text>,
tabBarIcon: ({ focused }) => <MaterialCommunityIcons color={focused ? constants.highlightBlue : "#000"} name="account-cog" size={25} />
};
return (
<NavigationContainer>
<Tab.Navigator screenOptions={{ tabBarStyle: { paddingBottom: 2 } }}>
<Stack.Screen name="Home" component={HomeScreen} options={homeScreenSettings} />
<Stack.Screen name="Consults" component={ConsultScreen} options={ConsultScreenSettings} />
<Stack.Screen name="Orders" navigation={navigation} children={()=> <TabNavigator item={item} /> } options={ordersScreenSettings} />
<Stack.Screen name="Profile" component={ProfileScreen} options={profileScreenSettings} />
</Tab.Navigator>
</NavigationContainer>
);
}