@jescon-technologies/react-native-ui-kit 0.0.14 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,775 @@
1
+ import React, { useContext, useEffect, useState } from 'react';
2
+ import {
3
+ StyleSheet,
4
+ Text,
5
+ View,
6
+ StatusBar,
7
+ Image,
8
+ TouchableOpacity,
9
+ Modal,
10
+ Dimensions,
11
+ ScrollView,
12
+ Platform,
13
+ DeviceEventEmitter,
14
+ ActivityIndicator,
15
+ FlatList,
16
+ StyleProp,
17
+ ViewStyle,
18
+ DimensionValue,
19
+ } from 'react-native';
20
+ import CSliderMenu from '../Custom/CSliderMenu';
21
+ import { normalize } from '../CommonStyle/componentStyle';
22
+ import { useNotifications } from '../Handlers/NotificationsContext';
23
+ import moment from 'moment';
24
+ import { ValueCheck } from '../CommonStyle/ComponentFunctions';
25
+ import ABlink from '../Alerts/ABlink';
26
+ import COverlay from '../CustomComponents/COverlay';
27
+ import OUserView from '../Custom/OUserView';
28
+ import CBackHandler from '../CustomComponents/CBackHandler';
29
+ import CNetworkStatus from '../CustomComponents/CNetworkStatus';
30
+ import CModalOverlay from '../CustomComponents/CModalOverlay';
31
+ import { useNavigation } from '../Navigation/useNavigation';
32
+ import NetworkServiceCall from '../Common/NetworkServiceCall';
33
+ import HIcons from '../Hoc/HIcons';
34
+ import ResponseComponentContext from '../Handlers/ResponseComponentContext';
35
+ import { Global } from '../../../../../src/Common/Global';
36
+ import { APIURL } from '../../../../../src/Common/apiConstants';
37
+
38
+ // import HelpdeskScreenFocus from '../Helpdesk/View/HelpdeskScreenFocus';
39
+ // import CHelpdeskView from '../Helpdesk/View/CHelpdeskView';
40
+
41
+ // ---------------------------------------------------------------------------
42
+ // Types
43
+ // ---------------------------------------------------------------------------
44
+
45
+ interface HeaderBlockProps {
46
+ style?: StyleProp<ViewStyle>;
47
+ backhandler?: unknown;
48
+ consultation?: unknown;
49
+ callback?: (goBack: boolean) => void;
50
+ webview?: unknown;
51
+ data?: unknown;
52
+ navigation?: (route: string, params?: object) => void;
53
+ APIURL?: string;
54
+ [key: string]: unknown;
55
+ }
56
+
57
+ interface NotificationItem {
58
+ status?: boolean;
59
+ heading?: string;
60
+ content?: string;
61
+ [key: string]: unknown;
62
+ }
63
+
64
+ interface ResponseContextValue {
65
+ responseJSON: unknown;
66
+ setResponseJSON: (value: unknown) => void;
67
+ }
68
+
69
+ interface NetworkResponse<T = unknown> {
70
+ httpstatus: number;
71
+ data: T;
72
+ }
73
+
74
+ interface NotificationsPayload {
75
+ data?: NotificationItem[];
76
+ }
77
+
78
+ interface UserDataLite {
79
+ suuser?: number;
80
+ username?: string;
81
+ department?: string;
82
+ [key: string]: unknown;
83
+ }
84
+
85
+ // `COverlay(OUserView)` shape — typed manually
86
+ type OverlayComponent = React.ComponentType<{
87
+ visibility: (val?: boolean) => void;
88
+ }>;
89
+
90
+ // ---------------------------------------------------------------------------
91
+ // Styles
92
+ // ---------------------------------------------------------------------------
93
+
94
+ const styles = StyleSheet.create({
95
+ container: {
96
+ // `Platform.OS != 'web' && '7%'` yields `false` on web — invalid
97
+ // DimensionValue. Applied at usage site via conditional spread.
98
+ backgroundColor: Global.AppTheme.primary_color,
99
+ justifyContent: 'center',
100
+ paddingLeft: normalize(3),
101
+ marginTop: StatusBar.currentHeight,
102
+ zIndex: 9999,
103
+ },
104
+ headerContent: {
105
+ flexDirection: 'row',
106
+ alignItems: 'center',
107
+ marginBottom: normalize(6),
108
+ paddingBottom: normalize(0),
109
+ },
110
+ backButton: {
111
+ flexDirection: 'row',
112
+ alignItems: 'center',
113
+ borderWidth: 0,
114
+ },
115
+ logoContainer: {
116
+ width: normalize(100),
117
+ height: normalize(40),
118
+ },
119
+ betaContainer: {
120
+ position: 'absolute',
121
+ bottom: normalize(-4),
122
+ right: normalize(-70),
123
+ },
124
+ betaText: {
125
+ color: '#ffffff',
126
+ fontSize: normalize(20),
127
+ letterSpacing: 5,
128
+ fontWeight: 'bold',
129
+ textShadowColor: '#000000',
130
+ textShadowOffset: { width: 0.5, height: 0.5 },
131
+ textShadowRadius: 0.5,
132
+ },
133
+ versionText: {
134
+ color: 'white',
135
+ fontSize: normalize(8),
136
+ },
137
+ userInfoButton: {
138
+ flexDirection: 'row',
139
+ borderWidth: 0,
140
+ flex: 1,
141
+ justifyContent: 'flex-start',
142
+ },
143
+ userInfoContainer: {
144
+ borderWidth: 0,
145
+ },
146
+ userNameText: {
147
+ fontWeight: 'bold',
148
+ fontSize: normalize(13),
149
+ marginLeft: 5,
150
+ color: 'white',
151
+ },
152
+ departmentText: {
153
+ fontFamily: Global.fontNormal,
154
+ fontSize: normalize(11),
155
+ marginLeft: 5,
156
+ color: 'white',
157
+ },
158
+ rightIconsContainer: {
159
+ flexDirection: 'row',
160
+ alignItems: 'center',
161
+ justifyContent: 'flex-end',
162
+ borderWidth: 0,
163
+ },
164
+ notificationButton: {
165
+ margin: normalize(10),
166
+ },
167
+ notificationBadge: {
168
+ position: 'absolute',
169
+ right: normalize(-2),
170
+ top: normalize(-2),
171
+ backgroundColor: 'white',
172
+ alignItems: 'center',
173
+ borderRadius: 20,
174
+ width: normalize(15),
175
+ },
176
+ notificationCount: {
177
+ fontSize: normalize(7),
178
+ fontWeight: 'bold',
179
+ },
180
+ menuButton: {
181
+ alignItems: 'center',
182
+ justifyContent: 'center',
183
+ },
184
+ loginTimeText: {
185
+ fontSize: normalize(9),
186
+ marginLeft: 0,
187
+ color: 'white',
188
+ },
189
+ jsonModalContainer: {
190
+ backgroundColor: 'white',
191
+ borderWidth: 1,
192
+ height: Dimensions.get('screen').height * 0.9,
193
+ alignSelf: 'center',
194
+ width: Dimensions.get('screen').width * 0.9,
195
+ },
196
+ closeButton: {
197
+ textAlign: 'right',
198
+ fontWeight: 'bold',
199
+ color: 'black',
200
+ },
201
+ jsonText: {
202
+ fontSize: normalize(10),
203
+ color: 'black',
204
+ fontFamily: 'Courier New',
205
+ },
206
+ iconBtn: {
207
+ width: normalize(32),
208
+ height: normalize(32),
209
+ borderRadius: normalize(16),
210
+ backgroundColor: 'rgba(255,255,255,0.12)',
211
+ alignItems: 'center',
212
+ justifyContent: 'center',
213
+ },
214
+ badge: {
215
+ position: 'absolute',
216
+ right: normalize(-1),
217
+ top: normalize(-1),
218
+ backgroundColor: '#FF5252',
219
+ borderRadius: normalize(8),
220
+ minWidth: normalize(15),
221
+ height: normalize(15),
222
+ alignItems: 'center',
223
+ justifyContent: 'center',
224
+ zIndex: 1,
225
+ paddingHorizontal: 3,
226
+ },
227
+ badgeText: {
228
+ color: 'white',
229
+ fontSize: normalize(8),
230
+ fontWeight: 'bold',
231
+ },
232
+ modalContainer: {
233
+ width: Platform.OS === 'web' ? 360 : '90%',
234
+ maxWidth: 400,
235
+ backgroundColor: '#FFFFFF',
236
+ borderRadius: normalize(12),
237
+ overflow: 'hidden',
238
+ shadowColor: '#000',
239
+ shadowOffset: { width: 0, height: 4 },
240
+ shadowOpacity: 0.25,
241
+ shadowRadius: 10,
242
+ elevation: 8,
243
+ },
244
+ modalHeader: {
245
+ flexDirection: 'row',
246
+ alignItems: 'center',
247
+ justifyContent: 'space-between',
248
+ paddingHorizontal: normalize(14),
249
+ paddingVertical: normalize(12),
250
+ borderBottomWidth: 1,
251
+ borderBottomColor: '#F0F0F0',
252
+ backgroundColor: '#FAFBFD',
253
+ },
254
+ modalTitle: {
255
+ fontSize: normalize(14),
256
+ fontWeight: 'bold',
257
+ color: '#094485',
258
+ },
259
+ modalBadge: {
260
+ backgroundColor: '#FF5252',
261
+ borderRadius: normalize(10),
262
+ paddingHorizontal: normalize(6),
263
+ paddingVertical: normalize(1),
264
+ marginLeft: normalize(6),
265
+ },
266
+ modalBadgeText: {
267
+ color: '#FFFFFF',
268
+ fontSize: normalize(10),
269
+ fontWeight: 'bold',
270
+ },
271
+ closeBtn: {
272
+ padding: normalize(4),
273
+ },
274
+ notifCard: {
275
+ flexDirection: 'row',
276
+ padding: normalize(12),
277
+ borderBottomWidth: 1,
278
+ borderBottomColor: '#F4F5F7',
279
+ alignItems: 'flex-start',
280
+ },
281
+ notifIconCircle: {
282
+ width: normalize(30),
283
+ height: normalize(30),
284
+ borderRadius: normalize(15),
285
+ backgroundColor: '#EBF3FB',
286
+ alignItems: 'center',
287
+ justifyContent: 'center',
288
+ marginRight: normalize(10),
289
+ marginTop: normalize(2),
290
+ },
291
+ notifHeading: {
292
+ fontSize: normalize(12),
293
+ fontWeight: 'bold',
294
+ color: '#1A202C',
295
+ marginBottom: normalize(2),
296
+ },
297
+ notifContent: {
298
+ fontSize: normalize(11),
299
+ color: '#4A5568',
300
+ lineHeight: normalize(15),
301
+ },
302
+ notifCodeText: {
303
+ fontSize: normalize(9),
304
+ color: '#A0AEC0',
305
+ marginTop: normalize(3),
306
+ },
307
+ modalFooter: {
308
+ borderTopWidth: 1,
309
+ borderTopColor: '#F0F0F0',
310
+ paddingVertical: normalize(10),
311
+ paddingHorizontal: normalize(14),
312
+ backgroundColor: '#FAFBFD',
313
+ alignItems: 'center',
314
+ },
315
+ viewAllBtn: {
316
+ flexDirection: 'row',
317
+ alignItems: 'center',
318
+ },
319
+ viewAllText: {
320
+ fontSize: normalize(12),
321
+ fontWeight: '600',
322
+ color: '#094485',
323
+ },
324
+ });
325
+
326
+ /** Platform-conditional `height: '7%'` (was the inline-invalid-value bug). */
327
+ const containerPlatformHeight: ViewStyle =
328
+ Platform.OS !== 'web' ? { height: '7%' as DimensionValue } : {};
329
+
330
+ // ---------------------------------------------------------------------------
331
+ // Component
332
+ // ---------------------------------------------------------------------------
333
+
334
+ const HeaderBlock: React.FC<HeaderBlockProps> = (props) => {
335
+ const { responseJSON, setResponseJSON } = useContext(
336
+ ResponseComponentContext
337
+ ) as ResponseContextValue;
338
+
339
+ const [isShowSlidermenu, setIsShowSlidermenu] = useState<boolean>(false);
340
+ const [backHandler, setBackHandler] = useState<boolean>(false);
341
+ const [backHandlerLogOut, setBackHandlerLogOut] = useState<boolean>(false);
342
+ const [refresh] = useState<number>(0);
343
+ const [overlay, setOverlay] = useState<boolean>(false);
344
+ const [jsonoverlay, setJsonOverlay] = useState<boolean>(false);
345
+ const navigation = useNavigation();
346
+ const [notificationList, setNotificationList] = useState<NotificationItem[]>([]);
347
+ const [unreadCount, setUnreadCount] = useState<number>(0);
348
+ const [showNotificationModal, setShowNotificationModal] = useState<boolean>(false);
349
+ const [isLoadingNotifications, setIsLoadingNotifications] = useState<boolean>(false);
350
+
351
+ const OverlayHOCComponent = COverlay(OUserView) as unknown as OverlayComponent;
352
+
353
+ const NoticationData = useNotifications() as NotificationItem[] | undefined;
354
+
355
+ const result = NoticationData.filter((obj) => obj.status === true);
356
+
357
+ const fetchNotifications = (): void => {
358
+ const userData = Global.userData as UserDataLite | null | undefined;
359
+ if (userData && userData.suuser) {
360
+ setIsLoadingNotifications(true);
361
+ const url =
362
+ APIURL + 'invget/invcommonget/rnhrsumessageuserretrievaljson ' + userData.suuser;
363
+ NetworkServiceCall('get', url)
364
+ .then((response: NetworkResponse<NotificationItem[] | NotificationsPayload>) => {
365
+ setIsLoadingNotifications(false);
366
+ if (response && response.httpstatus == 200) {
367
+ let dataArr: NotificationItem[] = [];
368
+ const data = response.data as NotificationsPayload | NotificationItem[];
369
+ if (
370
+ data &&
371
+ !Array.isArray(data) &&
372
+ Array.isArray((data as NotificationsPayload).data)
373
+ ) {
374
+ dataArr = (data as NotificationsPayload).data!;
375
+ } else if (Array.isArray(data)) {
376
+ dataArr = data;
377
+ }
378
+ setNotificationList(dataArr);
379
+ setUnreadCount(dataArr.length);
380
+ } else {
381
+ setNotificationList([]);
382
+ setUnreadCount(0);
383
+ }
384
+ })
385
+ .catch((err: unknown) => {
386
+ setIsLoadingNotifications(false);
387
+ console.log('Error fetching notifications in HeaderBlock:', err);
388
+ });
389
+ }
390
+ };
391
+
392
+ useEffect(() => {
393
+ fetchNotifications();
394
+ const sub = DeviceEventEmitter.addListener('refresh_notifications', fetchNotifications);
395
+ return () => {
396
+ sub?.remove?.();
397
+ };
398
+ // eslint-disable-next-line react-hooks/exhaustive-deps
399
+ }, []);
400
+
401
+ const goBack = (): void => {
402
+ Global.PatientDetails = null;
403
+ if (ValueCheck(props.backhandler)) {
404
+ if (ValueCheck(props.consultation) && Global.EditStatus == 1) {
405
+ setBackHandler(true);
406
+ } else {
407
+ console.log('props.backhandler', props.backhandler);
408
+ navigation.goBack();
409
+ }
410
+ } else {
411
+ navigation.goBack();
412
+ }
413
+ };
414
+
415
+ const OnPressGoBack = (): void => {
416
+ Global.PatientDetails = null;
417
+ if (props.callback) {
418
+ props.callback(true);
419
+ } else {
420
+ goBack();
421
+ }
422
+ };
423
+
424
+ const renderJsonModal = (): React.ReactElement => (
425
+ <Modal
426
+ onRequestClose={() => setJsonOverlay(false)}
427
+ style={{
428
+ height: Dimensions.get('screen').height,
429
+ width: Dimensions.get('screen').width,
430
+ backgroundColor: 'transparent',
431
+ justifyContent: 'center',
432
+ alignItems: 'center',
433
+ }}
434
+ transparent={true}
435
+ >
436
+ <View style={styles.jsonModalContainer}>
437
+ <TouchableOpacity onPress={() => setJsonOverlay(false)}>
438
+ <Text style={styles.closeButton}>Close</Text>
439
+ </TouchableOpacity>
440
+ <ScrollView>
441
+ <Text selectable={true} style={styles.jsonText}>
442
+ {JSON.stringify(responseJSON, null, 2)}
443
+ </Text>
444
+ </ScrollView>
445
+ </View>
446
+ </Modal>
447
+ );
448
+
449
+ const renderBetaVersion = (): React.ReactElement => (
450
+ <View style={styles.betaContainer}>
451
+ <ABlink duration={500}>
452
+ <View style={{ justifyContent: 'center', alignItems: 'center' }}>
453
+ <Text style={styles.betaText}>BETA TESTING</Text>
454
+ <Text style={styles.versionText}>
455
+ {Global.version ? `V ${Global.version}` : null}
456
+ </Text>
457
+ </View>
458
+ </ABlink>
459
+ </View>
460
+ );
461
+
462
+ const userData = Global.userData as UserDataLite | null | undefined;
463
+
464
+ console.log('userData in HeaderBlock:', JSON.stringify(userData));
465
+
466
+ const renderUserInfo = (): React.ReactElement => (
467
+ <TouchableOpacity
468
+ onPress={() => (props.webview != undefined ? null : setOverlay(true))}
469
+ style={styles.userInfoButton}
470
+ >
471
+ <View style={styles.userInfoContainer}>
472
+ <Text adjustsFontSizeToFit numberOfLines={2} style={styles.userNameText}>
473
+ {props.webview != undefined
474
+ ? ''
475
+ : userData && userData.department != undefined && userData.department != ''
476
+ ? userData.username
477
+ : ''}
478
+ </Text>
479
+ {userData &&
480
+ userData.department != undefined &&
481
+ userData.department != '' &&
482
+ props.webview == undefined ? (
483
+ <Text adjustsFontSizeToFit style={styles.departmentText}>
484
+ {userData.department}
485
+ </Text>
486
+ ) : null}
487
+ </View>
488
+ </TouchableOpacity>
489
+ );
490
+
491
+ const renderRightIcons = (): React.ReactElement => (
492
+ <View style={styles.rightIconsContainer}>
493
+ {Platform.OS === 'web' && (
494
+ <TouchableOpacity
495
+ onPress={() => DeviceEventEmitter.emit('helpdesk.toggle')}
496
+ style={[
497
+ styles.iconBtn,
498
+ { flexDirection: 'row', width: 'auto', paddingHorizontal: normalize(8) },
499
+ ]}
500
+ >
501
+ <HIcons.FontAwesome5
502
+ name="question-circle"
503
+ size={normalize(12)}
504
+ color="white"
505
+ style={{ marginRight: normalize(4) }}
506
+ />
507
+ <Text
508
+ style={{ color: 'white', fontSize: normalize(10), fontWeight: 'bold' }}
509
+ >
510
+ HELP
511
+ </Text>
512
+ </TouchableOpacity>
513
+ )}
514
+ <CNetworkStatus />
515
+ <TouchableOpacity
516
+ onPress={() => {
517
+ fetchNotifications();
518
+ setShowNotificationModal(true);
519
+ }}
520
+ style={styles.notificationButton}
521
+ >
522
+ <ABlink>
523
+ <View
524
+ style={[
525
+ styles.notificationBadge,
526
+ { backgroundColor: result.length > 0 ? 'red' : 'white' },
527
+ ]}
528
+ >
529
+ <Text
530
+ numberOfLines={1}
531
+ adjustsFontSizeToFit
532
+ style={[
533
+ styles.notificationCount,
534
+ { color: result.length > 0 ? 'white' : 'black' },
535
+ ]}
536
+ >
537
+ {result.length}
538
+ </Text>
539
+ </View>
540
+ </ABlink>
541
+
542
+ <HIcons.Ionicons name="notifications-outline" size={normalize(18)} color="white" />
543
+ {unreadCount > 0 && (
544
+ <View style={styles.badge}>
545
+ <Text style={styles.badgeText}>
546
+ {unreadCount > 99 ? '99+' : unreadCount}
547
+ </Text>
548
+ </View>
549
+ )}
550
+ </TouchableOpacity>
551
+ <View style={{ paddingLeft: normalize(2) }}>
552
+ <TouchableOpacity
553
+ onPress={() => setIsShowSlidermenu(true)}
554
+ style={styles.menuButton}
555
+ >
556
+ <HIcons.Feather name={'menu'} color="white" size={normalize(25)} />
557
+ <View>
558
+ {Global.LoginTime != undefined ? (
559
+ <Text style={styles.loginTimeText}>
560
+ {moment.duration(moment().diff(Global.LoginTime)).asMinutes().toFixed(0) +
561
+ ' Min.'}
562
+ </Text>
563
+ ) : null}
564
+ </View>
565
+ </TouchableOpacity>
566
+ </View>
567
+ </View>
568
+ );
569
+
570
+ const renderNotificationContent = (): React.ReactElement => (
571
+ <View style={styles.modalContainer}>
572
+ <View style={styles.modalHeader}>
573
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
574
+ <HIcons.Ionicons
575
+ name="notifications"
576
+ size={normalize(18)}
577
+ color="#094485"
578
+ style={{ marginRight: normalize(6) }}
579
+ />
580
+ <Text style={styles.modalTitle}>Notifications</Text>
581
+ {unreadCount > 0 && (
582
+ <View style={styles.modalBadge}>
583
+ <Text style={styles.modalBadgeText}>{unreadCount}</Text>
584
+ </View>
585
+ )}
586
+ </View>
587
+ <TouchableOpacity
588
+ onPress={() => setShowNotificationModal(false)}
589
+ style={styles.closeBtn}
590
+ >
591
+ <HIcons.Ionicons name="close" size={normalize(20)} color="#666" />
592
+ </TouchableOpacity>
593
+ </View>
594
+
595
+ {isLoadingNotifications ? (
596
+ <View style={{ padding: normalize(20), alignItems: 'center' }}>
597
+ <ActivityIndicator size="small" color="#094485" />
598
+ <Text
599
+ style={{ marginTop: normalize(8), fontSize: normalize(11), color: '#666' }}
600
+ >
601
+ Loading notifications...
602
+ </Text>
603
+ </View>
604
+ ) : notificationList && notificationList.length > 0 ? (
605
+ <FlatList<NotificationItem>
606
+ data={notificationList}
607
+ keyExtractor={(_item, index) => 'notif_' + index}
608
+ style={{ maxHeight: normalize(320) }}
609
+ renderItem={({ item }) => (
610
+ <View style={styles.notifCard}>
611
+ <View style={styles.notifIconCircle}>
612
+ <HIcons.Ionicons
613
+ name="chatbox-ellipses-outline"
614
+ size={normalize(16)}
615
+ color="#094485"
616
+ />
617
+ </View>
618
+ <View style={{ flex: 1 }}>
619
+ <Text style={styles.notifHeading}>
620
+ {item.heading || 'PUBLIC MESSAGE'}
621
+ </Text>
622
+ <Text style={styles.notifContent}>{item.content || ''}</Text>
623
+ </View>
624
+ </View>
625
+ )}
626
+ />
627
+ ) : (
628
+ <View style={{ padding: normalize(24), alignItems: 'center' }}>
629
+ <HIcons.Ionicons
630
+ name="notifications-off-outline"
631
+ size={normalize(32)}
632
+ color="#ccc"
633
+ />
634
+ <Text
635
+ style={{ marginTop: normalize(8), fontSize: normalize(12), color: '#888' }}
636
+ >
637
+ No new notifications
638
+ </Text>
639
+ </View>
640
+ )}
641
+ </View>
642
+ );
643
+
644
+ const renderNotificationFooter = (): React.ReactElement => (
645
+ <View style={styles.modalFooter}>
646
+ <TouchableOpacity
647
+ style={styles.viewAllBtn}
648
+ onPress={() => {
649
+ setShowNotificationModal(false);
650
+ navigation.navigate('Notifications');
651
+ }}
652
+ >
653
+ <Text style={styles.viewAllText}>View All Notifications</Text>
654
+ <HIcons.Ionicons
655
+ name="arrow-forward"
656
+ size={normalize(14)}
657
+ color="#094485"
658
+ style={{ marginLeft: normalize(4) }}
659
+ />
660
+ </TouchableOpacity>
661
+ </View>
662
+ );
663
+
664
+ return (
665
+ <View
666
+ style={[styles.container, containerPlatformHeight, props.style]}
667
+ key={refresh}
668
+ >
669
+ {/* <HelpdeskScreenFocus data={props.data} /> */}
670
+ <StatusBar
671
+ translucent
672
+ backgroundColor={Global.AppTheme.primary_color}
673
+ barStyle="light-content"
674
+ />
675
+
676
+ {jsonoverlay && renderJsonModal()}
677
+
678
+ <View style={styles.headerContent}>
679
+ <TouchableOpacity
680
+ style={styles.backButton}
681
+ onPress={OnPressGoBack}
682
+ onLongPress={goBack}
683
+ >
684
+ <HIcons.Ionicons name={'chevron-back'} color="white" size={normalize(25)} />
685
+ <View style={styles.logoContainer}>
686
+ {Global.betaversion ? (
687
+ <View style={styles.logoContainer} />
688
+ ) : (
689
+ <Image
690
+ style={{
691
+ width: normalize(100),
692
+ height: normalize(40),
693
+ resizeMode: 'contain',
694
+ borderRadius: 8,
695
+ }}
696
+ source={{
697
+ uri:
698
+ Global?.HospitalData?.hospitallogo3
699
+ ? Global.HospitalData.hospitallogo3
700
+ : undefined,
701
+ }}
702
+ />
703
+ )}
704
+ </View>
705
+ {Global.betaversion && renderBetaVersion()}
706
+ </TouchableOpacity>
707
+
708
+ {renderUserInfo()}
709
+
710
+ {props.webview != undefined ? null : renderRightIcons()}
711
+ </View>
712
+
713
+ {overlay && (
714
+ <OverlayHOCComponent
715
+ visibility={(val?: boolean) => (val == undefined ? null : setOverlay(val))}
716
+ />
717
+ )}
718
+
719
+ <CModalOverlay
720
+ visible={showNotificationModal}
721
+ onClose={() => setShowNotificationModal(false)}
722
+ closeOnTouchOutside={true}
723
+ containerStyle={{
724
+ alignItems: 'flex-end',
725
+ justifyContent: 'flex-start',
726
+ paddingTop: Platform.OS === 'web' ? 60 : 50,
727
+ paddingRight: normalize(10),
728
+ }}
729
+ childrenWrapperStyle={styles.modalContainer}
730
+ contentStyle={{ flexGrow: 0 }}
731
+ footer={renderNotificationFooter()}
732
+ footerStyle={{ padding: 0 }}
733
+ >
734
+ {renderNotificationContent()}
735
+ </CModalOverlay>
736
+
737
+ {isShowSlidermenu && (
738
+ <CSliderMenu
739
+ navigation={navigation}
740
+ isShow={isShowSlidermenu}
741
+ visibility={(val?: boolean) =>
742
+ val == undefined ? null : setIsShowSlidermenu(val)
743
+ }
744
+ />
745
+ )}
746
+
747
+ {backHandler && (
748
+ <CBackHandler
749
+ type={5}
750
+ callBack={(val?: boolean) =>
751
+ val == undefined ? null : (setBackHandler(val), navigation.goBack())
752
+ }
753
+ close={(val?: boolean) => (val == undefined ? null : setBackHandler(val))}
754
+ />
755
+ )}
756
+
757
+ {backHandlerLogOut && (
758
+ <CBackHandler
759
+ type={6}
760
+ callBack={(val?: boolean) =>
761
+ val == undefined
762
+ ? null
763
+ : (setBackHandlerLogOut(val), navigation.goBack())
764
+ }
765
+ close={(val?: boolean) =>
766
+ val == undefined ? null : setBackHandlerLogOut(val)
767
+ }
768
+ />
769
+ )}
770
+ {/* <CHelpdeskView defaultModuleCode={Global.module} floating={false} /> */}
771
+ </View>
772
+ );
773
+ };
774
+
775
+ export default HeaderBlock;