-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
579 lines (564 loc) · 18.4 KB
/
App.js
File metadata and controls
579 lines (564 loc) · 18.4 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
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
import React, { useState, useEffect } from "react";
import { StyleSheet, SafeAreaView, StatusBar, Image, View } from "react-native";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { NavigationContainer, DefaultTheme } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import AppLoading from "expo-app-loading";
import * as Font from "expo-font";
import { Ionicons, FontAwesome } from "@expo/vector-icons";
import AsyncStorage from "@react-native-async-storage/async-storage";
// Assets
import { Colors, Metrics, Images } from "./assets/Themes";
import CustomIcons from "./assets/Fonts";
// Components
import { Browse, Profile, Network, Notifications } from "./screens";
//import screens
import Upload from "./screens/Upload/index";
import Studio from "./screens/Upload/studio";
import SoundsGood from "./screens/Upload/soundsGood";
import CoverPhoto from "./screens/Upload/CoverPhoto";
import InboxPage from "./screens/Profile/components/InboxPage";
import NewMessagePage from "./screens/Profile/components/newMessagePage";
import OtherInbox from "./screens/Browse/components/otherUserChat";
import ChatPage from "./screens/Profile/components/chatPage";
import OtherProfile from "./screens/Profile/components/otherProfile";
import OtherConnection from "./screens/Browse/components/otherConnection";
import SoundEvolution from "./screens/SoundEvolution/";
import HonestChat from "./screens/Notifications/components/honestChat";
import HonestChatProfile from "./screens/Profile/components/honestChatProfile";
import Onboarding from "./screens/Onboarding";
import OnboardingSwipe from "./screens/OnboardingSwipe";
import SearchUsers from "./screens/Browse/components/searchUsers";
import Connections from "./screens/Profile/components/connections";
// Use this to get colors from theme
// import { useTheme } from '@react-navigation/native';
// const { colors } = useTheme();
const Theme = {
...DefaultTheme,
colors: {
...DefaultTheme.colors,
primary: Colors.primary,
background: Colors.background1,
text1: Colors.white,
text2: Colors.gray,
},
};
// Browse Screen Stack
const BrowseStack = createStackNavigator();
function BrowseStackComponent() {
return (
<BrowseStack.Navigator
headerMode="float"
screenOptions={{
headerStyle: {
backgroundColor: Colors.background1,
elevation: 0,
shadowOpacity: 0,
borderBottomWidth: 0,
},
shadowColor: "transparent",
headerTintColor: Colors.white,
headerTitleStyle: {
fontFamily: "Kollektif-Bold",
fontSize: 24,
},
headerBackTitleVisible: false,
headerBackImage: () => (
<View style={styles.backButton}>
<Ionicons name="arrow-back" size={24} color={Colors.white} />
</View>
),
}}
>
<BrowseStack.Screen name="Explore" component={Browse} />
<BrowseStack.Screen name="SoundbitePopup" component={Upload} />
<BrowseStack.Screen name="Studio" component={Studio} />
<BrowseStack.Screen name="Sounds Good" component={SoundsGood} />
<BrowseStack.Screen name="Upload a Cover Photo" component={CoverPhoto} />
<BrowseStack.Screen name="Profile" component={Profile} />
<BrowseStack.Screen name="Sound Evolution" component={SoundEvolution} />
<BrowseStack.Screen name="Other Inbox" component={OtherInbox} />
<BrowseStack.Screen name="Other Connection" component={OtherConnection} />
<BrowseStack.Screen name="Search Users" component={SearchUsers} />
</BrowseStack.Navigator>
);
}
// Network Screen Stack
const NetworkStack = createStackNavigator();
function NetworkStackComponent() {
return (
<NetworkStack.Navigator
headerMode="float"
headerMode="float"
screenOptions={{
headerStyle: {
backgroundColor: Colors.background1,
elevation: 0,
shadowOpacity: 0,
borderBottomWidth: 0,
},
shadowColor: "transparent",
headerTintColor: Colors.white,
headerTitleStyle: {
fontFamily: "Kollektif-Bold",
fontSize: 24,
},
headerBackTitleVisible: false,
headerBackImage: () => (
<View style={styles.backButton}>
<Ionicons name="arrow-back" size={24} color={Colors.white} />
</View>
),
}}
>
<NetworkStack.Screen name="My Network" component={Network} />
<NetworkStack.Screen name="Profile" component={Profile} />
<NetworkStack.Screen name="Other Inbox" component={OtherInbox} />
<NetworkStack.Screen
name="Other Connection"
component={OtherConnection}
/>
<NetworkStack.Screen name="Connections" component={Connections} />
</NetworkStack.Navigator>
);
}
// Upload Screen Stack
const UploadStack = createStackNavigator();
function UploadStackComponent() {
return (
<UploadStack.Navigator
initialRouteName="Upload"
headerMode="float"
headerMode="float"
screenOptions={{
headerStyle: {
backgroundColor: Colors.background1,
elevation: 0,
shadowOpacity: 0,
borderBottomWidth: 0,
},
shadowColor: "transparent",
headerTintColor: Colors.white,
headerTitleStyle: {
fontFamily: "Kollektif-Bold",
fontSize: 24,
},
headerBackTitleVisible: false,
headerBackImage: () => (
<View style={styles.backButton}>
<Ionicons name="arrow-back" size={24} color={Colors.white} />
</View>
),
}}
>
<UploadStack.Screen name="Upload" component={Upload} />
<UploadStack.Screen name="Studio" component={Studio} />
<UploadStack.Screen name="Sounds Good" component={SoundsGood} />
<UploadStack.Screen name="Upload a Cover Photo" component={CoverPhoto} />
</UploadStack.Navigator>
);
}
// Notification Screen Stack
const NotificationStack = createStackNavigator();
function NotificationStackComponent() {
return (
<NotificationStack.Navigator
headerMode="float"
headerMode="float"
screenOptions={{
headerBackTitleVisible: false,
headerBackImage: () => (
<View style={styles.backButton}>
<Ionicons name="arrow-back" size={24} color={Colors.white} />
</View>
),
headerStyle: {
backgroundColor: Colors.background1,
elevation: 0,
shadowOpacity: 0,
borderBottomWidth: 0,
},
shadowColor: "transparent",
headerTintColor: Colors.white,
headerTitleStyle: {
fontFamily: "Kollektif-Bold",
fontSize: 24,
},
headerBackTitleVisible: false,
headerBackImage: () => (
<View style={styles.backButton}>
<Ionicons name="arrow-back" size={24} color={Colors.white} />
</View>
),
}}
>
<NotificationStack.Screen
name="Notifications"
component={Notifications}
/>
<NotificationStack.Screen
name="Honest Profile"
component={OtherProfile}
options={{
title: "@brunetted",
}}
/>
<NotificationStack.Screen
name="Honest Chat"
component={HonestChat}
options={{
title: "@brunetted",
}}
/>
<NotificationStack.Screen
name="Sound Evolution"
component={SoundEvolution}
/>
<NotificationStack.Screen name="Profile" component={Profile} />
<NotificationStack.Screen name="Other Inbox" component={OtherInbox} />
<NotificationStack.Screen
name="Other Connection"
component={OtherConnection}
/>
</NotificationStack.Navigator>
);
}
// Profile Screen Stack
const ProfileStack = createStackNavigator();
function ProfileStackComponent() {
return (
<ProfileStack.Navigator
headerMode="float"
headerMode="float"
screenOptions={{
headerStyle: {
backgroundColor: Colors.background1,
elevation: 0,
shadowOpacity: 0,
borderBottomWidth: 0,
},
shadowColor: "transparent",
headerTintColor: Colors.white,
headerTitleStyle: {
fontSize: 24,
fontFamily: "Kollektif-Bold",
},
headerBackTitleVisible: false,
headerBackImage: () => (
<View style={styles.backButton}>
<Ionicons name="arrow-back" size={24} color={Colors.white} />
</View>
),
}}
>
<ProfileStack.Screen
name="Profile"
component={Profile}
options={{ title: "@arianaventi" }}
/>
<ProfileStack.Screen
name="My Network"
component={Network}
options={({ route, navigation }) => ({
// title: route.params.profile,
headerBackTitleVisible: false,
headerBackImage: () => (
<View style={styles.backButton}>
<Ionicons name="arrow-back" size={24} color={Colors.white} />
</View>
),
headerRight: () => (
<Ionicons
name="chatbubble-ellipses-outline"
size={32}
color={Colors.white}
style={{ marginRight: Metrics.headerMarginHorizontal }}
onPress={() => navigation.navigate("My Inbox")}
/>
),
})}
/>
<ProfileStack.Screen name="New Message" component={NewMessagePage} />
<ProfileStack.Screen
name="My Inbox"
component={InboxPage}
options={({ navigation }) => ({
headerBackTitleVisible: false,
headerRight: () => (
<FontAwesome
name="pencil-square-o"
size={32}
color={Colors.white}
style={{ marginRight: Metrics.headerMarginHorizontal }}
onPress={() => navigation.navigate("New Message")}
/>
),
})}
/>
<ProfileStack.Screen
name="Honest Chat Profile"
component={HonestChatProfile}
options={{
title: "@brunetted",
}}
/>
<ProfileStack.Screen
name="chat"
component={ChatPage}
options={({ route }) => ({
title: route.params.userName,
})}
/>
<ProfileStack.Screen name="Connections" component={Connections} />
</ProfileStack.Navigator>
);
}
export default function App() {
const [appLoading, setAppLoading] = useState(false);
const [viewedOnboarding, setViewedOnboarding] = useState(false);
// Asynchronously load the custom fonts icons from icomoon
const loadResourcesAsync = async () =>
Promise.all([
Font.loadAsync({
"custom-icons": require("./assets/Fonts/sprout-v4.ttf"),
Kollektif: require("./assets/Fonts/Kollektif.ttf"),
"Kollektif-Bold": require("./assets/Fonts/Kollektif-Bold.ttf"),
"Kollektif-Italic": require("./assets/Fonts/Kollektif-Italic.ttf"),
}),
]);
// Handle error loading
const handleLoadingError = (error) => {
console.warn(error);
};
// Handle finish loading
const handleFinishLoading = () => {
setAppLoading(true);
};
const Loading = () => {
return (
<View>
<ActivityIndicator size="large" />
</View>
);
};
const checkOnboarding = async () => {
try {
const value = await AsyncStorage.getItem("@viewedOnboarding");
if (value !== null) {
setViewedOnboarding(true);
}
} catch (err) {
console.log("Error @checkOnboarding: ", err);
}
};
useEffect(() => {
checkOnboarding();
}, []);
if (!appLoading) {
return (
<AppLoading
startAsync={loadResourcesAsync}
onError={handleLoadingError}
onFinish={handleFinishLoading}
/>
);
}
if (!viewedOnboarding) {
return <OnboardingSwipe onDone={setViewedOnboarding} />;
}
const Tab = createBottomTabNavigator();
return (
<>
{/* {viewedOnboarding ? <Onboarding/> : */}
<SafeAreaView style={styles.topSafeArea} />
<SafeAreaView style={styles.bottomSafeArea}>
<StatusBar barStyle="light-content" />
<NavigationContainer theme={Theme}>
<Tab.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ focused, color, size }) => {
let icon;
switch (route.name) {
case "BrowseTab":
icon = focused ? (
// <CustomIcons name="home-filled" color={color} size={size} />
<CustomIcons
name="home-filled"
color={color}
size={size}
/>
) : (
<CustomIcons name="home" color={color} size={size} />
);
break;
case "NetworkTab":
icon = focused ? (
// <CustomIcons
// name="network-filled"
// color={color}
// size={size}
// />
<Ionicons name="people" size={size} color={color} />
) : (
// <CustomIcons name="bookmark" color={color} size={size} />
// <CustomIcons name="network" color={color} size={size} />
<Ionicons
name="people-outline"
size={size}
color={color}
/>
);
break;
case "UploadTab":
icon = focused ? (
<Image
source={require("./assets/Images/add.png")}
style={styles.upload}
/>
) : (
<Image
source={require("./assets/Images/add.png")}
style={styles.upload}
/>
);
break;
case "NotificationsTab":
icon = focused ? (
<View style={{ position: "relative" }}>
<CustomIcons
name="notification-filled"
color={color}
size={size}
/>
<View
style={{
height: 12,
width: 12,
borderRadius: 6,
backgroundColor: Colors.primary,
position: "absolute",
top: 0,
right: 0,
borderColor: Colors.background1,
borderWidth: 2,
}}
></View>
</View>
) : (
<View style={{ position: "relative" }}>
<CustomIcons
name="notification"
color={color}
size={size}
/>
<View
style={{
height: 12,
width: 12,
borderRadius: 6,
backgroundColor: Colors.primary,
position: "absolute",
top: 0,
right: 0,
borderColor: Colors.background1,
borderWidth: 2,
}}
></View>
</View>
);
break;
case "ProfileTab":
icon = focused ? (
<View style={styles.iconContainerFocused}>
<Image
style={styles.pfp}
source={Images.ariana_venti}
/>
{/* <CustomText customStyle={{ fontSize: 10 }}>
Profile
</CustomText> */}
</View>
) : (
<View style={styles.iconContainer}>
<Image
style={styles.pfp}
source={Images.ariana_venti}
/>
</View>
);
break;
default:
null;
}
return icon;
},
})}
tabBarOptions={{
activeTintColor: Colors.white,
inactiveTintColor: "gray",
showLabel: false,
style: {
backgroundColor: Colors.blur,
height: Metrics.tabBarHeight,
borderTopWidth: 0,
},
}}
>
<Tab.Screen name="BrowseTab" component={BrowseStackComponent} />
<Tab.Screen name="NetworkTab" component={NetworkStackComponent} />
<Tab.Screen name="UploadTab" component={UploadStackComponent} />
<Tab.Screen
name="NotificationsTab"
component={NotificationStackComponent}
/>
<Tab.Screen name="ProfileTab" component={ProfileStackComponent} />
</Tab.Navigator>
</NavigationContainer>
</SafeAreaView>
</>
);
}
const styles = StyleSheet.create({
topSafeArea: {
flex: 0,
backgroundColor: Colors.background1,
},
bottomSafeArea: {
flex: 1,
borderRadius: 21,
backgroundColor: Colors.background1,
},
upload: {
marginTop: 10,
width: 75,
height: undefined,
aspectRatio: 1,
},
backButton: {
borderColor: Colors.background2,
borderWidth: 2,
borderRadius: 10,
justifyContent: "center",
alignItems: "center",
marginLeft: Metrics.headerMarginHorizontal,
},
iconContainer: {
justifyContent: "center",
alignItems: "center",
},
iconContainerFocused: {
justifyContent: "center",
alignItems: "center",
borderColor: Colors.white,
borderWidth: 2.5,
borderRadius: 35 / 2,
height: 35,
width: 35,
},
pfp: {
width: 30,
height: 30,
// margin: 5,
// marginBottom: 8,
},
});