-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
226 lines (215 loc) · 6.85 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
const Stack = createNativeStackNavigator();
import * as React from "react";
import { StyleSheet } from 'react-native';
import { NavigationContainer } from "@react-navigation/native";
import { useFonts } from "expo-font";
import SignUpIcon from "./screens/SignUpIcon";
import PatientProfile from "./screens/PatientProfile";
import DoctorsCalendar from "./screens/DoctorsCalendar";
import DoctorsProfile from "./screens/DoctorsProfile";
import DoctorsList from "./screens/DoctorsList";
import DocCalendar from "./screens/DocCalendar";
import DocHome from "./screens/DocHome";
import PatientHome from "./screens/PatientHome";
import DocLoginIcon from "./screens/DocLoginIcon";
import LoginIcon from "./screens/LoginIcon";
import DocSignupFormIcon from "./screens/DocSignupFormIcon";
import DocSignUpIcon from "./screens/DocSignUpIcon";
import Chats1 from "./components/Chats1";
import Chats from "./components/Chats";
import Contacts3 from "./components/Contacts3";
import Contacts2 from "./components/Contacts2";
import Contacts1 from "./components/Contacts1";
import Contacts from "./components/Contacts";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import {
View,
Text,
Pressable,
TouchableOpacity,
SafeAreaView,
} from "react-native";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import DetailScreen from "./screens/DetailScreen";
import HomeScreen from "./screens/PatientHome";
const Tab = createBottomTabNavigator();
function BottomTabsRoot({ navigation }) {
const [bottomTabItemsNormal] = React.useState([
<Chats />,
<Contacts2 />,
<Contacts />,
]);
const [bottomTabItemsActive] = React.useState([
<Chats1 />,
<Contacts3 />,
<Contacts1 />,
]);
return (
<Tab.Navigator
screenOptions={{ headerShown: false }}
tabBar={({ state, descriptors, navigation }) => {
const activeIndex = state.index;
return (
<SafeAreaView>
<View
style={{
alignSelf: "stretch",
backgroundColor: "#fff",
height: 69,
flexDirection: "row",
paddingHorizontal: 60,
paddingVertical: 15,
alignItems: "center",
justifyContent: "space-between",
}}
>
{bottomTabItemsNormal.map((item, index) => {
const isFocused = state.index === index;
return (
<Pressable
key={index}
onPress={() => {
navigation.navigate({
name: state.routes[index].name,
merge: true,
});
}}
>
{activeIndex === index
? bottomTabItemsActive[index] || item
: item}
</Pressable>
);
})}
</View>
</SafeAreaView>
);
}}
>
<Tab.Screen
name="PatientHome"
component={HomeScreen}
options={{ headerShown: false }}
/>
<Tab.Screen
name="DoctorsList"
component={DoctorsList}
options={{ headerShown: false }}
/>
<Tab.Screen
name="PatientProfile"
component={PatientProfile}
options={{ headerShown: false }}
/>
</Tab.Navigator>
);
}
const App = () => {
const [hideSplashScreen, setHideSplashScreen] = React.useState(true);
const [fontsLoaded, error] = useFonts({
Roboto_regular: require("./assets/fonts/Roboto_regular.ttf"),
Roboto_medium: require("./assets/fonts/Roboto_medium.ttf"),
Roboto_bold: require("./assets/fonts/Roboto_bold.ttf"),
Montserrat_regular: require("./assets/fonts/Montserrat_regular.ttf"),
Montserrat_medium: require("./assets/fonts/Montserrat_medium.ttf"),
Montserrat_semibold: require("./assets/fonts/Montserrat_semibold.ttf"),
Montserrat_bold_italic: require("./assets/fonts/Montserrat_bold_italic.ttf"),
"Work Sans_regular": require("./assets/fonts/Work_Sans_regular.ttf"),
});
if (!fontsLoaded && !error) {
return null;
}
return (
<>
<NavigationContainer>
{hideSplashScreen ? (
<Stack.Navigator
initialRouteName="HomeScreen"
screenOptions={{ headerShown: false }}
>
<Stack.Screen name="BottomTabsRoot" component={BottomTabsRoot} />
<Stack.Screen
name="SignUp"
component={SignUpIcon}
options={{ headerShown: false }}
/>
<Stack.Screen
name="DoctorsCalendar"
component={DoctorsCalendar}
options={{ headerShown: false }}
/>
<Stack.Screen
name="DoctorsProfile"
component={DoctorsProfile}
options={{ headerShown: false }}
/>
<Stack.Screen
name="DocCalendar"
component={DocCalendar}
options={{ headerShown: false }}
/>
<Stack.Screen
name="DocHome"
component={DocHome}
options={{ headerShown: false }}
/>
<Stack.Screen
name="DocLogin"
component={DocLoginIcon}
options={{ headerShown: false }}
/>
<Stack.Screen
name="Login"
component={LoginIcon}
options={{ headerShown: false }}
/>
<Stack.Screen
name="DocSignupForm"
component={DocSignupFormIcon}
options={{ headerShown: false }}
/>
<Stack.Screen
name="DocSignUp"
component={DocSignUpIcon}
options={{ headerShown: false }}
/>
<Stack.Screen name="HomeScreen" component={HomeScreen} />
<Stack.Screen
name="Details"
component={DetailScreen}
options={({ navigation }) => ({
headerShown: true,
headerLeft: () => (
<TouchableOpacity onPress={() => navigation.goBack()}>
<Text style={styles.backButton}>Back</Text>
</TouchableOpacity>
),
headerTitle: '',
headerStyle: { backgroundColor: 'white' },
headerTintColor: 'orange',
})}
/>
</Stack.Navigator>
) : null}
</NavigationContainer>
</>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'white',
},
text: {
fontSize: 24,
color: 'orange',
},
backButton: {
marginLeft: 15,
color: 'orange',
fontSize: 18,
},
});
export default App;