-
Notifications
You must be signed in to change notification settings - Fork 3
/
App.js
4111 lines (3882 loc) · 113 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
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
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
import 'react-native-gesture-handler';
import React, {useEffect} from 'react';
import {useState} from 'react';
import {Checkbox} from 'react-native-paper';
import Icon from 'react-native-vector-icons/Ionicons';
import Ionicons from 'react-native-vector-icons/Ionicons';
import Fontisto from 'react-native-vector-icons/Fontisto';
import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
import MIcon from 'react-native-vector-icons/MaterialCommunityIcons';
import {useTogglePasswordVisibility} from './useTogglePasswordVisibility';
import {
ALERT_TYPE,
Dialog,
AlertNotificationRoot,
Toast,
AlertNotificationDialog,
} from 'react-native-alert-notification';
import {
createDrawerNavigator,
DrawerContentScrollView,
DrawerItemList,
} from '@react-navigation/drawer';
import {NavigationContainer} from '@react-navigation/native';
import {createNativeStackNavigator} from '@react-navigation/native-stack';
import {
Button,
Image,
ScrollView,
StatusBar,
StyleSheet,
Text,
TextInput,
TouchableOpacity,
View,
ImageBackground,
Linking,
Alert,
} from 'react-native';
import {black} from 'react-native-paper/lib/typescript/styles/themes/v2/colors';
import EncryptedStorage from 'react-native-encrypted-storage';
import axios from 'axios';
const Stack = createNativeStackNavigator();
const Drawer = createDrawerNavigator();
const redcolor = '#C53437';
const URL = 'http://20.102.109.51:8080';
const showSuccessToast = message => {
Toast.show({
type: ALERT_TYPE.SUCCESS,
title: 'Success',
textBody: message,
});
};
axios.interceptors.request.use(
async config => {
const token = await EncryptedStorage.getItem('JWT');
if (token) {
config.headers.Authorization = 'Bearer ' + token;
}
config.headers['Content-Type'] = 'application/json';
return config;
},
error => {
Promise.reject(error);
},
);
axios.interceptors.response.use(
response => response,
error => {
Dialog.show({
type: ALERT_TYPE.DANGER,
title: 'ERROR',
textBody: error.response.data.error,
button: 'close',
});
throw error;
},
);
const App = () => {
return (
<AlertNotificationRoot>
<NavigationContainer>
{/*<View*/}
{/* style={{*/}
{/* position: 'absolute',*/}
{/* zIndex: 1, // works on ios*/}
{/* elevation: 1, // works on android*/}
{/* }}>*/}
{/* <Image source={require('./images/barcircle.png')} style={{}} />*/}
{/*</View>*/}
<Stack.Navigator
initialRouteName="Main Screen"
screenOptions={{
headerTitleAlign: 'center',
headerShadowVisible: false,
headerTitleStyle: {
fontSize: 22,
fontFamily: 'Outfit-Regular',
color: 'black',
},
headerRight: () => <Icon name="search" size={30} color="#292D32" />,
}}>
<Stack.Screen name="TempHome" component={TempHome} />
<Stack.Screen
name="Main Screen"
component={MainScreen}
options={{headerShown: false}}
/>
<Stack.Screen
name="Login Screen"
component={LoginScreen}
options={{headerShown: false}}
/>
<Stack.Screen
name="SignUp Screen"
component={SignUpScreen}
options={{headerShown: false}}
/>
<Stack.Screen
name="Forget Password"
component={ForgetPassword}
options={{headerShown: false}}
/>
<Stack.Screen
name="OTPPassword Screen"
component={OTPPassword}
options={{headerShown: false}}
/>
<Stack.Screen
name="ResetPassword Screen"
component={ResetPassword}
options={{headerShown: false}}
/>
<Stack.Screen
name="ResetPasswordComplete Screen"
component={ResetPasswordComplete}
options={{headerShown: false}}
/>
<Stack.Screen name="Get Donations" component={GetDonations} />
<Stack.Screen name="My Campaigns" component={MyCampaigns} />
<Stack.Screen name="Donors" component={Donors} />
<Stack.Screen name="Active Campaigns" component={ActiveCampaigns} />
<Stack.Screen name="Blood Banks" component={BloodBanks} />
<Stack.Screen name="Campaign Details" component={CampaignDetails} />
<Stack.Screen name="Feedback" component={Feedback} />
<Stack.Screen name="About Us" component={AboutUs} />
<Stack.Screen name="Donation History" component={DonationHistory} />
<Stack.Screen name="Profile" component={Profile} />
<Stack.Screen name="Top Donors" component={TopDonors} />
<Stack.Screen name="Privacy Policy" component={PrivacyPolicy} />
<Stack.Screen
name="Home"
component={DashboardScreen}
options={{headerShown: false}}
/>
<Stack.Screen
name="Blood Type"
component={BloodTypeScreen}
options={{headerShown: false}}
/>
<Stack.Screen
name="Settings"
component={SettingsScreen}
options={{headerShown: false}}
/>
<Stack.Screen
name="Socials"
component={SocialsScreen}
options={{headerShown: false}}
/>
<Stack.Screen
name="Drawer"
component={DrawerM}
options={{headerShown: false}}
/>
</Stack.Navigator>
</NavigationContainer>
</AlertNotificationRoot>
);
};
//Tayyab's Screens
const PrivacyPolicy = () => {
return (
<View style={{flex: 1, backgroundColor: '#EBEBEB'}}>
<ScrollView>
<View style={styles.titleContainer}>
<Image
style={{height: 140, width: 140, marginTop: 40}}
source={require('./images/bloodLogo.png')}
/>
<ScreenTitle title={'Privacy Policy for Blood Donation Inc'} />
</View>
<View style={{marginLeft: 10, marginRight: 10}}>
<Text style={{fontSize: 15, fontWeight: 'bold'}}>
At Blood Donation Inc, accessible from www.DonateBlood.com, one of
our main priorities is the privacy of our visitors.
{'\n'}
{'\n'}This Privacy Policy document contains types of information
that is collected and recorded by Blood Donation Inc and how we use
it.{'\n'}
If you have additional questions or require more information about
our Privacy Policy, do not hesitate to contact us. {'\n'}
{'\n'}
This Privacy Policy applies only to our online activities and is
valid for visitors to our website with regards to the information
that they shared and/or collect in Blood Donation Inc. This policy
is not applicable to any information collected offline or via
channels other than this website. {'\n'}
Consent By using our website, you hereby consent to our Privacy
Policy and agree to its terms. {'\n'}
{'\n'}
Information we collect {'\n'}
{'\n'}
The personal information that you are asked to provide, and the
reasons why you are asked to provide it, will be made clear to you
at the point we ask you to provide your personal information. {'\n'}
If you contact us directly, we may receive additional information
about you such as your name, email address, phone number, the
contents of the message and/or attachments you may send us, and any
other information you may choose to provide. {'\n'}
When you register for an Account, we may ask for your contact
information, including items such as name, company name, address,
email address, and telephone number. {'\n'}
{'\n'}
How we use your information {'\n'}
We use the information we collect in various ways, including to:
{'\n'}
Provide, operate, and maintain our website{'\n'}
Improve, personalize, and expand our website{'\n'}
Understand and analyze how you use our website{'\n'}
Develop new products, services, features, and functionality{'\n'}
Communicate with you, either directly or through one of our
partners, including for customer service, to provide you with
updates and other information relating to the website, and for
marketing and promotional purposes{'\n'}
Send you emails{'\n'}
Find and prevent fraud{'\n'}
{'\n'}
Log Files
{'\n'}
Blood Donation Inc follows a standard procedure of using log files.
These files log visitors when they visit websites. All hosting
companies do this and a part of hosting services' analytics. The
information collected by log files include internet protocol (IP)
addresses, browser type, Internet Service Provider (ISP), date and
time stamp, referring/exit pages, and possibly the number of clicks.
These are not linked to any information that is personally
identifiable. The purpose of the information is for analyzing
trends, administering the site, tracking users' movement on the
website, and gathering demographic information.{'\n'}
Cookies and Web Beacons{'\n'}
{'\n'}
Like any other website, Blood Donation Inc uses 'cookies'. These
cookies are used to store information including visitors'
preferences, and the pages on the website that the visitor accessed
or visited. The information is used to optimize the users'
experience by customizing our web page content based on visitors'
browser type and/or other information.{'\n'}
Advertising Partners Privacy Policies{'\n'}
You may consult this list to find the Privacy Policy for each of the
advertising partners of Blood Donation Inc.{'\n'}
{'\n'}
Third-party ad servers or ad networks uses technologies like
cookies, JavaScript, or Web Beacons that are used in their
respective advertisements and links that appear on Blood Donation
Inc, which are sent directly to users' browser. They automatically
receive your IP address when this occurs. These technologies are
used to measure the effectiveness of their advertising campaigns
and/or to personalize the advertising content that you see on
websites that you visit.{'\n'}
Note that Blood Donation Inc has no access to or control over these
cookies that are used by third-party advertisers.{'\n'}
{'\n'}
Third Party Privacy Policies{'\n'}
Blood Donation Inc's Privacy Policy does not apply to other
advertisers or websites. Thus, we are advising you to consult the
respective Privacy Policies of these third-party ad servers for more
detailed information. It may include their practices and
instructions about how to opt-out of certain options.{'\n'}
You can choose to disable cookies through your individual browser
options. To know more detailed information about cookie management
with specific web browsers, it can be found at the browsers'
respective websites.{'\n'}
{'\n'}
CCPA Privacy Rights (Do Not Sell My Personal Information){'\n'}
Under the CCPA, among other rights, California consumers have the
right to:{'\n'}
{'\n'}
Request that a business that collects a consumer's personal data
disclose the categories and specific pieces of personal data that a
business has collected about consumers.{'\n'}
{'\n'}
Request that a business delete any personal data about the consumer
that a business has collected.{'\n'}
{'\n'}
Request that a business that sells a consumer's personal data, not
sell the consumer's personal data.{'\n'}
{'\n'}
If you make a request, we have one month to respond to you. If you
would like to exercise any of these rights, please contact us.{'\n'}
{'\n'}
GDPR Data Protection Rights{'\n'}
We would like to make sure you are fully aware of all of your data
protection rights. Every user is entitled to the following:{'\n'}
{'\n'}
The right to access – You have the right to request copies of your
personal data. We may charge you a small fee for this service.{'\n'}
{'\n'}
The right to rectification – You have the right to request that we
correct any information you believe is inaccurate. You also have the
right to request that we complete the information you believe is
incomplete.{'\n'}
{'\n'}
The right to erasure – You have the right to request that we erase
your personal data, under certain conditions.{'\n'}
{'\n'}
The right to restrict processing – You have the right to request
that we restrict the processing of your personal data, under certain
conditions.{'\n'}
{'\n'}
The right to object to processing – You have the right to object to
our processing of your personal data, under certain conditions.
{'\n'}
{'\n'}
The right to data portability – You have the right to request that
we transfer the data that we have collected to another organization,
or directly to you, under certain conditions.{'\n'}
{'\n'}
If you make a request, we have one month to respond to you. If you
would like to exercise any of these rights, please contact us.{'\n'}
{'\n'}
Children's Information Another part of our priority is adding
protection for children while using the internet. We encourage
parents and guardians to observe, participate in, and/or monitor and
guide their online activity.{'\n'}
{'\n'}
Blood Donation Inc does not knowingly collect any Personal
Identifiable Information from children under the age of 13. If you
think that your child provided this kind of information on our
website, we strongly encourage you to contact us immediately and we
will do our best efforts to promptly remove such information from
our records.{'\n'}
</Text>
<View style={styles.rectangle} />
</View>
</ScrollView>
</View>
);
};
const TopDonors = () => {
return (
<View style={{flex: 1, backgroundColor: '#EBEBEB'}}>
<ScrollView>
<View style={styles.titleContainer}>
<Image
style={{height: 140, width: 140, marginTop: 40}}
source={require('./images/bloodLogo.png')}
/>
<View style={{marginTop: -48}}>
<ScreenTitle title={'Congratulations!'} />
</View>
<Text
style={{
fontSize: 25,
marginTop: -40,
textAlign: 'center',
color: redcolor,
}}>
Thank you for being the{'\n'}reason someone lives{'\n'}another day
</Text>
</View>
<TopDonorsCardJamal name="Jamal Blackman" year="2018" bags="8" />
<TopDonorsCardMujtaba name="Mujtaba Aziz Khan" year="2022" bags="6" />
<TopDonorsCardTouseef name="Muhammad Touseef" year="2021" bags="4" />
<TopDonorsCardTayyab name="M. Tayyab Naveed" year="2021" bags="2" />
<View style={styles.rectangle} />
</ScrollView>
</View>
);
};
const Profile = ({navigation}) => {
return (
<View style={{flex: 1, backgroundColor: '#EBEBEB'}}>
<ScrollView>
<View
style={{
marginTop: 20,
marginLeft: 20,
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'row',
}}>
<Image
style={{
height: 200,
width: 200,
borderRadius: 100,
borderWidth: 4,
borderColor: '#C53437',
}}
source={require('./images/placeholder.png')}
/>
<TouchableOpacity>
<Image
style={{height: 20, width: 20, marginBottom: 100}}
source={require('./images/Gear.png')}
/>
</TouchableOpacity>
</View>
<View
style={{
alignItems: 'center',
justifyContent: 'center',
flexDirection: 'row',
marginTop: 5,
marginLeft: 20,
}}>
<Text style={{fontSize: 20, color: 'black'}}>John Doe</Text>
<TouchableOpacity>
<Image
style={{height: 20, width: 20, marginLeft: 5, marginRight: 10}}
source={require('./images/Gear.png')}
/>
</TouchableOpacity>
</View>
<View style={styles.container}>
<ProfileCardGender gender="Male" />
<ProfileCardAddress address="House No 92, Street 49, H-Block, Soan Gardens" />
<ProfileCardBlood blood="O+" />
<ProfileCardMedications medications="None" />
<ProfileCardIllness illnesses="None" />
</View>
<TouchableOpacity
onPress={() => {
navigation.navigate('Privacy Policy');
}}>
<Text
style={{
color: redcolor,
marginLeft: 10,
fontFamily: 'Outfit-Regular',
fontSize: 16,
}}>
Privacy Policy
</Text>
</TouchableOpacity>
<View style={styles.rectangle} />
</ScrollView>
</View>
);
};
const DonationHistory = () => {
return (
<View style={{flex: 1, backgroundColor: '#EBEBEB'}}>
<ScrollView>
<View style={styles.titleContainer}>
<Image
style={{height: 140, width: 140, marginTop: 40}}
source={require('./images/bloodLogo.png')}
/>
<ScreenTitle title={'We Are So Proud \n Of You!'} />
<Image
style={{
height: 125,
width: 125,
borderRadius: 100,
borderWidth: 4,
borderColor: '#C53437',
}}
source={require('./images/placeholder.png')}
/>
<Text style={{fontWeight: 'bold', fontSize: 20, marginTop: 7}}>
John Doe
</Text>
</View>
<HistoryCard
date="4/2/2021"
location="4 Pitras Bukhari Rd, H-8/4 H 8/4 H-8 Islamabad"
campaign="No"
/>
<HistoryCard
date="12/7/2021"
location="4 Pitras Bukhari Rd, H-8/4 H 8/4 H-8 Islamabad"
campaign="Yes"
/>
<HistoryCard
date="3/2/2022"
location="4 Pitras Bukhari Rd, H-8/4 H 8/4 H-8 Islamabad"
campaign="No"
/>
<HistoryCard
date="14/8/2022"
location="4 Pitras Bukhari Rd, H-8/4 H 8/4 H-8 Islamabad"
campaign="No"
/>
<View style={styles.rectangle} />
</ScrollView>
</View>
);
};
const AboutUs = () => {
return (
<View style={{flex: 1, backgroundColor: '#EBEBEB'}}>
<ScrollView>
<View style={styles.titleContainer}>
<Image
style={{height: 140, width: 140, marginTop: 40}}
source={require('./images/bloodLogo.png')}
/>
<ScreenTitle title={'About Us'} />
</View>
<View style={styles.container}>
<Text style={styles.tAboutUs}>
This organization Was{'\n'}Created To Aid Blood{'\n'}Transfusions
Across{'\n'}Pakistan. We Aim To{'\n'}Facilitate This Process{'\n'}
Through This Application.{'\n'}With This Application{'\n'}People Can
Pledge To{'\n'}Donate To Active Blood{'\n'}Campaigns. This Method
{'\n'}Will Provide Ease And{'\n'}Confirmation On The{'\n'}People
Willing To Donate.{'\n'}
{'\n'}
<Text style={{fontStyle: 'italic'}}>
Not All Heroes Wear Capes, Some Simply Donate Blood.
</Text>
</Text>
</View>
<View style={styles.titleContainer}>
<Text style={styles.title}>Founders</Text>
</View>
<View style={styles.container}>
<View style={{flexDirection: 'row', justifyContent: 'space-evenly'}}>
<Image
style={{
height: 100,
width: 100,
borderRadius: 100,
marginRight: 30,
}}
source={require('./images/Arshik.jpg')}
/>
<Image
style={{
height: 100,
width: 100,
borderRadius: 100,
marginLeft: 30,
}}
source={require('./images/Touseef.jpg')}
/>
</View>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
marginTop: 5,
}}>
<Text style={{marginRight: 20, fontWeight: 'bold', fontSize: 18}}>
Syed Arshik Javed
</Text>
<Text style={{marginLeft: 0, fontWeight: 'bold', fontSize: 18}}>
Muhammad Touseef
</Text>
</View>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-evenly',
marginTop: 30,
}}>
<Image
style={{
height: 100,
width: 100,
borderRadius: 100,
marginRight: 30,
}}
source={require('./images/Tayyab.jpg')}
/>
<Image
style={{
height: 100,
width: 100,
borderRadius: 100,
marginLeft: 30,
}}
source={require('./images/Mujtaba.jpg')}
/>
</View>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-between',
marginTop: 5,
}}>
<Text style={{marginRight: 15, fontWeight: 'bold', fontSize: 18}}>
M. Tayyab Naveed
</Text>
<Text style={{marginLeft: 15, fontWeight: 'bold', fontSize: 18}}>
Mujtaba Aziz Khan
</Text>
</View>
</View>
<View style={styles.rectangle} />
</ScrollView>
</View>
);
};
const Feedback = () => {
const [message, setMessage] = useState('');
const getFeedback = async () => {
console.log(
//////////////
Feedback,
);
try {
let res = await axios.post(`${URL}/api/v1/user/feedback/`, {
message: message,
});
if (res.data.success === true) {
showSuccessToast('Successfully Sent Feedback');
}
} catch {}
};
return (
<View style={{flex: 1, backgroundColor: '#EBEBEB'}}>
<ScrollView>
<View style={styles.titleContainer}>
<Image
style={{height: 140, width: 140, marginTop: 40}}
source={require('./images/bloodLogo.png')}
/>
<ScreenTitle title={'We Would Love to \n Hear Your \n Feedback!'} />
</View>
<View style={styles.container}>
<Text style={styles.tfield}>Email</Text>
<TextInput style={styles.input} />
</View>
<View style={styles.container}>
<Text style={styles.tfield}>Feedback</Text>
<TextInput style={styles.inputFeedback} onChangeText={setMessage} />
</View>
<View style={styles.container}>
<TouchableOpacity style={styles.btn} onPress={getFeedback}>
<Text style={styles.btnText}>Send</Text>
</TouchableOpacity>
</View>
<View style={styles.rectangle} />
</ScrollView>
</View>
);
};
//Arshik's Screens
const MainScreen = ({navigation}) => {
const check = async () => {
let token = await EncryptedStorage.getItem('JWT');
if (token) {
navigation.navigate('Drawer');
}
};
useEffect(() => {
check();
}, []);
return (
<View style={styles.main}>
<ScrollView>
<Text style={styles.paragraph} />
<View style={styles.topLeft} />
<View>
<Image
style={{height: 90, width: 90, alignSelf: 'center', marginTop: -60}}
source={require('./images/whiteblood.png')}
/>
</View>
<TouchableOpacity onPress={() => navigation.navigate('Login Screen')}>
<View
style={{
backgroundColor: 'white',
borderWidth: 1,
borderRadius: 10,
borderColor: 'white',
padding: 20,
width: 350,
marginTop: 180,
alignContent: 'center',
marginLeft: 20,
}}>
<Text
style={{
textAlign: 'center',
color: '#B0303B',
fontSize: 22,
fontFamily: 'Outfit-Regular',
}}>
Sign In
</Text>
</View>
</TouchableOpacity>
<TouchableOpacity onPress={() => navigation.navigate('SignUp Screen')}>
<View
style={{
backgroundColor: '#5A1616',
borderWidth: 1,
borderRadius: 10,
borderColor: 'white',
padding: 20,
width: 350,
marginTop: 20,
alignContent: 'center',
marginLeft: 20,
marginBottom: -20,
}}>
<Text
style={{
textAlign: 'center',
color: '#DFDBDB',
fontSize: 22,
fontFamily: 'Outfit-Regular',
}}>
Create Account
</Text>
</View>
</TouchableOpacity>
<View style={{flexDirection: 'column'}}>
<TouchableOpacity>
<Text
style={{
color: '#DFDBDB',
marginTop: 100,
marginLeft: 23,
fontFamily: 'Outfit-Regular',
}}>
{' '}
Learn More{' '}
</Text>
</TouchableOpacity>
<TouchableOpacity>
<Text
style={{
marginTop: -18,
color: '#DFDBDB',
marginLeft: 280,
fontFamily: 'Outfit-Regular',
}}>
{' '}
Skip Now{' '}
</Text>
</TouchableOpacity>
</View>
<TouchableOpacity>
<View style={{top: -22, marginLeft: 345}}>
<MIcon name="arrow-right" size={25} color="#FFFFFF" />
</View>
</TouchableOpacity>
</ScrollView>
</View>
);
};
const LoginScreen = ({navigation}) => {
const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const {passwordVisibility, rightIcon, handlePasswordVisibility} =
useTogglePasswordVisibility();
const login = async () => {
try {
let res = await axios.post(`${URL}/api/v1/auth/login`, {
email: username,
password: password,
});
if (res.data.success === true) {
await EncryptedStorage.setItem('JWT', res.data.token);
navigation.navigate('Drawer');
}
} catch {}
};
return (
<View style={styles.main}>
<ScrollView>
<Text style={styles.paragraph} />
<View style={styles.topLeft} />
<TouchableOpacity
onPress={() =>
Dialog.show({
type: ALERT_TYPE.SUCCESS,
title: 'Welcome to Blood Bank',
button: 'Close',
})
}>
<View>
<Image
style={{
height: 90,
width: 90,
alignSelf: 'center',
marginTop: -70,
marginBottom: 70,
}}
source={require('./images/whiteblood.png')}
/>
</View>
</TouchableOpacity>
<View style={{alignItems: 'center', marginTop: 10}}>
<TextInput
placeholderTextColor={'#D0B5B5'}
onChangeText={setUsername}
style={{
borderBottomWidth: 1,
width: '90%',
padding: 5,
fontSize: 22,
fontFamily: 'Outfit-Regular',
}}
placeholder="Username"
/>
<TextInput
onChangeText={setPassword}
placeholderTextColor={'#D0B5B5'}
style={{
padding: 5,
borderBottomWidth: 1,
width: '90%',
marginTop: 70,
fontSize: 22,
fontFamily: 'Outfit-Regular',
}}
placeholder="Password"
secureTextEntry={passwordVisibility}
/>
<TouchableOpacity onPress={handlePasswordVisibility}>
<View style={{marginLeft: 320, marginTop: -35}}>
<MIcon name="eye" size={33} color="#FFFFFF" />
</View>
</TouchableOpacity>
<View style={{alignItems: 'center'}}>
<TouchableOpacity onPress={login}>
<View
style={{
backgroundColor: '#F2F2F2',
borderWidth: 1,
borderRadius: 10,
borderColor: 'white',
padding: 10,
width: 220,
marginTop: 70,
alignContent: 'center',
marginLeft: 20,
alignItems: 'center',
alignSelf: 'center',
}}>
<Text
style={{
textAlign: 'center',
color: '#B0303B',
fontSize: 22,
fontFamily: 'Outfit-Regular',
}}>
Login
</Text>
</View>
</TouchableOpacity>
<View style={{marginTop: 20, marginLeft: 25, alignSelf: 'center'}}>
<TouchableOpacity
onPress={() => navigation.navigate('Forget Password')}>
<Text
style={{
fontFamily: 'Outfit-Regular',
color: '#FFFFFF',
fontSize: 18,
}}>
Forget Password?
</Text>
</TouchableOpacity>
</View>
<View style={{marginTop: 40, marginLeft: 25, alignSelf: 'center'}}>
<TouchableOpacity
onPress={() => navigation.navigate('SignUp Screen')}>
<Text style={{color: '#FFFFFF', fontFamily: 'Outfit-Regular'}}>
Don't Have An Account?{' '}
<Text
style={{fontFamily: 'Outfit-Regular', fontWeight: 'bold'}}>
Sign Up
</Text>
</Text>
</TouchableOpacity>
</View>
</View>
</View>
</ScrollView>
</View>
);
};
const SignUpScreen = ({navigation}) => {
const [name, setName] = useState('');
const [email, setEmail] = useState('');
const [password, setPassword] = useState('');
const [Confirmpassword, setConfirmPassword] = useState('');
const [phone, setPhone] = useState('');
const {passwordVisibility, rightIcon, handlePasswordVisibility} =
useTogglePasswordVisibility();
const SignUpFunc = async () => {
try {
if (Confirmpassword == password) {
let res = await axios.post(`${URL}/api/v1/auth/register`, {
name: name,
email: email,
password: password,
phonenumber: phone,
});
if (res.data.success === true) {
await EncryptedStorage.setItem('JWT', res.data.token);
Dialog.show({
type: ALERT_TYPE.SUCCESS,
title: 'Signed Up Successfully',
textBody: '',
button: 'Close',
});
navigation.navigate('Login Screen');
} else {
}
}
} catch {}
};
return (
<View style={styles.main}>
<StatusBar backgroundColor={redcolor} />
<Text style={styles.paragraph} />
<View style={styles.topLeft} />