@jescon-technologies/react-native-ui-kit 0.0.8 → 0.0.10

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,619 @@
1
+
2
+ import ComponentStyles from '../CommonStyle/componentStyle';
3
+ import { colors, fontWeight } from '../CommonStyle/commonStyle';
4
+ import {
5
+ ToastAndroid,
6
+ Platform,
7
+ Alert,
8
+ PermissionsAndroid,
9
+ ActivityIndicator,
10
+ DeviceEventEmitter,
11
+ PixelRatio,
12
+ Dimensions,
13
+ View,
14
+ Image,
15
+ } from 'react-native';
16
+ import NetInfo from '@react-native-community/netinfo';
17
+ import { Global } from '../../../../../src/Common/Global';
18
+ import { APIURL } from '../../../../../src/Common/apiConstants';
19
+ import React from 'react';
20
+
21
+ const {
22
+ width: SCREEN_WIDTH,
23
+ height: SCREEN_HEIGHT,
24
+ } = Dimensions.get('window');
25
+
26
+ const scale = SCREEN_WIDTH / 320;
27
+
28
+ export function CButtonShadow() {
29
+
30
+ const isAndroidBelow9 = Platform.OS === 'android' && Platform.Version < 28;
31
+ return isAndroidBelow9 ? {
32
+ elevation: 10,
33
+ shadowColor: Global.AppTheme.primary_color,
34
+ shadowOffset: { width: 5, height: 5 },
35
+ shadowOpacity: 0,
36
+ shadowRadius: 20,
37
+ } : {
38
+ boxShadow: `-3 3 6 -1 ${Global.AppTheme.primary_color}`,
39
+ }; // offsetX offsetY blurRadius spreadDistance color
40
+ }
41
+
42
+ export function CFooterShadow() {
43
+
44
+ const isAndroidBelow9 = Platform.OS === 'android' && Platform.Version < 28;
45
+ return isAndroidBelow9 ? {
46
+ elevation: 10,
47
+ shadowColor: Global.AppTheme.primary_color,
48
+ shadowOffset: { width: 5, height: 5 },
49
+ shadowOpacity: 0,
50
+ shadowRadius: 20,
51
+ } : {
52
+ boxShadow: `0 4 10 0 ${Global.AppTheme.primary_color}`,
53
+ }; // offsetX offsetY blurRadius spreadDistance color
54
+ }
55
+
56
+ export function LoaderIndicator(i) {
57
+
58
+ return (
59
+
60
+ <View style={{
61
+ backgroundColor: '#ffffff',
62
+ padding: normalize(10),
63
+ paddingHorizontal: normalize(20),
64
+ borderRadius: 10,
65
+ alignItems: 'center',
66
+ }}>
67
+ <Image
68
+ style={{
69
+ width: normalize(35),
70
+ height: normalize(35),
71
+ }}
72
+ // source={require('../Assets/gif/loading.gif')}
73
+ source={{uri: `${APIURL}file/getCommonFile/image/heartpulse.gif`}}
74
+ resizeMode={Image.resizeMode.contain}
75
+ />
76
+ </View>
77
+ );
78
+
79
+ }
80
+
81
+ export function normalize(size) {
82
+ const newSize = scale < 1.5 ? size * scale : size * 1.6;
83
+ if (Platform.OS === 'ios') {
84
+ return Math.round(PixelRatio.roundToNearestPixel(newSize)) - 2;
85
+ } else {
86
+ return Math.round(PixelRatio.roundToNearestPixel(newSize)) - 2;
87
+ }
88
+ }
89
+
90
+ export function Loader() {
91
+ return (
92
+ <ActivityIndicator size={normalize(30)} style={{ marginTop: normalize(10) }} color="red" />
93
+ );
94
+ }
95
+
96
+ export function CShadowDynamic(
97
+ offsetX = 0,
98
+ offsetY = 2,
99
+ blurRadius = 6,
100
+ spreadDistance = 0,
101
+ color = 'rgba(0, 0, 0, 0.2)',
102
+ ) {
103
+ const isAndroidBelow9 = Platform.OS === 'android' && Platform.Version < 28;
104
+
105
+ return isAndroidBelow9
106
+ ? {
107
+ elevation: 6,
108
+ shadowColor: color,
109
+ shadowOffset: {width: offsetX, height: offsetY},
110
+ shadowOpacity: 0.25,
111
+ shadowRadius: blurRadius,
112
+ }
113
+ : {
114
+ boxShadow: `${offsetX}px ${offsetY}px ${blurRadius}px ${spreadDistance}px ${color}`,
115
+ };
116
+ }
117
+
118
+ export async function getAppVersion() {
119
+ var Ver = 1.1;
120
+ const Results = await codePush.getUpdateMetadata();
121
+ if (Results) {
122
+ if (Results.isPending == false) {
123
+ Ver = Results.appVersion + Results.label;
124
+ } else {
125
+ Ver = Results.appVersion + Results.label + ' NOT UPDATED !!!';
126
+ }
127
+ }
128
+ return Ver;
129
+ }
130
+
131
+
132
+ /**
133
+ * To check whether value is true && null && undefined
134
+ */
135
+ export function isBNU(i) {
136
+ return (i && i != null && i != undefined ? true : false);
137
+ }
138
+
139
+ /**
140
+ * To check whether value is null && undefined
141
+ */
142
+ export function isNU(i) { return (i != null && i != undefined ? true : false); }
143
+
144
+ /**
145
+ * To check whether value is null && undefined && length > 0
146
+ */
147
+ export function isNUL(i) { return (i != null && i != undefined && i.length > 0 ? true : false); }
148
+
149
+ /**
150
+ * To check whether value is null && undefined && !=""
151
+ */
152
+ export function isNUQ(i) { return (i != null && i != undefined && i != '' ? true : false); }
153
+
154
+ /**
155
+ * To check whether value is null && undefined && !="" && != 0
156
+ */
157
+ export function isNUQZ(i) { return (i != null && i != undefined && i != '' && i != 0 ? true : false); }
158
+
159
+ /**
160
+ * To check whether value is true && null && undefined && length > 0
161
+ */
162
+ export function isBNUL(i) {
163
+ return (i && i != null && i != undefined && i.length > 0 ? true : false);
164
+ }
165
+
166
+ export function isOrganism(i) {
167
+ return (i == 3 ? true : false);
168
+ }
169
+
170
+ export function isDescription(i) {
171
+ return (i == 1 || i == 6 || i == 7 || i == 8 ? true : false);
172
+ }
173
+
174
+ export function isValueBased(i) {
175
+ return (i == 2 || i == 4 || i == 5 ? true : false);
176
+ }
177
+
178
+ export function dlog(i) {
179
+ if (__DEV__) {
180
+ return console.log(i);
181
+ }
182
+ else {
183
+
184
+ }
185
+ }
186
+
187
+ export function cdev() {
188
+ if (__DEV__) {
189
+ return true;
190
+ }
191
+ else {
192
+ return false;
193
+ }
194
+ }
195
+
196
+ export function clog(i) {
197
+ return console.log(i);
198
+ }
199
+
200
+
201
+
202
+
203
+ export function ValueCheck(value) {
204
+ if (value) {
205
+ return true;
206
+ } else {
207
+ false;
208
+ }
209
+ }
210
+
211
+ export function convertStringToArrayWeekDay(inputString) {
212
+ const days = [
213
+ { datavalue: 1, displayvalue: 'Su', selected: true },
214
+ { datavalue: 2, displayvalue: 'M', selected: true },
215
+ { datavalue: 3, displayvalue: 'Tu', selected: true },
216
+ { datavalue: 4, displayvalue: 'W', selected: true },
217
+ { datavalue: 5, displayvalue: 'Th', selected: true },
218
+ { datavalue: 6, displayvalue: 'F', selected: true },
219
+ { datavalue: 7, displayvalue: 'Sa', selected: true },
220
+ ];
221
+ const selectedDays = inputString.split(',').map(Number);
222
+ return days.map((day) => {
223
+ return {
224
+ datavalue: day.datavalue,
225
+ displayvalue: day.displayvalue,
226
+ selected: selectedDays.includes(day.datavalue) ? false : true,
227
+ // selected: day.selected,
228
+ };
229
+ });
230
+ }
231
+
232
+ export function ArrayCheck(value) {
233
+ if (value && value.length > 0) {
234
+ return true;
235
+ } else {
236
+ false;
237
+ }
238
+ }
239
+
240
+ export async function isPermitted() {
241
+ if (Platform.OS === 'android') {
242
+ try {
243
+ const apiLevel = Platform.Version;
244
+
245
+ // Android 13+ (API 33+) - need READ_MEDIA permissions
246
+ if (apiLevel >= 33) {
247
+ const granted = await PermissionsAndroid.request(
248
+ PermissionsAndroid.PERMISSIONS.READ_MEDIA_IMAGES
249
+ );
250
+ return granted === PermissionsAndroid.RESULTS.GRANTED;
251
+ }
252
+ // Android 10-12 (API 29-32) - Scoped Storage, no permission needed
253
+ else if (apiLevel >= 29) {
254
+ return true;
255
+ }
256
+ // Android 9 and below - need WRITE_EXTERNAL_STORAGE
257
+ else {
258
+ const granted = await PermissionsAndroid.request(
259
+ PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE
260
+ );
261
+ return granted === PermissionsAndroid.RESULTS.GRANTED;
262
+ }
263
+ } catch (err) {
264
+ Alert.alert('File access Permission not allowed', err.toString());
265
+ return false;
266
+ }
267
+ } else {
268
+ return true;
269
+ }
270
+ }
271
+
272
+ export function getLoading(load) {
273
+ setTimeout(load, 15000);
274
+ }
275
+ export function isDes(i) {
276
+ return (i == 1 ? true : false);
277
+ }
278
+
279
+ export function isVal(i) {
280
+ return (i == 2 ? true : false);
281
+ }
282
+
283
+ export function isOrg(i) {
284
+ return (i == 3 ? true : false);
285
+ }
286
+
287
+ export function isSero(i) {
288
+ return (i == 4 ? true : false);
289
+ }
290
+
291
+ export function isViro(i) {
292
+ return (i == 5 ? true : false);
293
+ }
294
+
295
+ export function isPath(i) {
296
+ return (i == 6 ? true : false);
297
+ }
298
+
299
+ export function isConnected() {
300
+ return new Promise((resolve, reject) => {
301
+ NetInfo.fetch().then(state => {
302
+ console.log('Connection type', state.type);
303
+ console.log('Is connected?', state.isConnected);
304
+ console.log('Is Internet?', state.isInternetReachable);
305
+ console.log('Details: - ', state.details);
306
+
307
+ if (state.isConnected && state.isInternetReachable) {
308
+ resolve();
309
+ }
310
+ else {
311
+ reject();
312
+ }
313
+ });
314
+ });
315
+ }
316
+
317
+ //Footer icon
318
+ export function getFooterIcon(opacity) {
319
+ return (
320
+ {
321
+ ...ComponentStyles.footer_Icon,
322
+ opacity: opacity,
323
+ }
324
+ );
325
+ }
326
+
327
+ export function notifyMessage(msg, type) {
328
+ DeviceEventEmitter.emit('event.testToast', {
329
+ 'displaytext': msg,
330
+ 'datavalue': type,
331
+ });
332
+
333
+ // let X = bottom != undefined && bottom != null ? bottom : 80
334
+ // if (Platform.OS === 'android') {
335
+ // ToastAndroid.showWithGravityAndOffset(msg, ToastAndroid.LONG, ToastAndroid.BOTTOM,
336
+ // 0,
337
+ // X)
338
+ // } else {
339
+ // Alert.alert(msg);
340
+ // }
341
+ }
342
+
343
+ export function getFooterIconText(opacity, color) {
344
+ return (
345
+ {
346
+ ...ComponentStyles.footer_Icon_Text,
347
+ opacity: opacity,
348
+ color: color,
349
+ }
350
+ );
351
+ }
352
+
353
+ // Header Section
354
+
355
+ export function getHeaderBlockContainer(width) {
356
+ return (
357
+ {
358
+ ...ComponentStyles.header_section_conatiner_style,
359
+ width: width,
360
+ paddingTop: '5%',
361
+ }
362
+ );
363
+ }
364
+ export function getHeaderTitleContainer(width) {
365
+ return (
366
+ {
367
+ justifyContent: 'flex-end', paddingLeft: width * 0.02,
368
+ }
369
+ );
370
+ }
371
+
372
+ export function getResultViewObservedvalueTextvalidate(value, minvalue, maxvalue, datatype) {
373
+ switch (datatype) {
374
+ case 'integer':
375
+ case 'numeric':
376
+ if (minvalue != null && minvalue != undefined && value < minvalue) {
377
+ return colors.color_resulttext_low;
378
+ }
379
+ else if (maxvalue != null && maxvalue != undefined && value > maxvalue) {
380
+ return colors.color_resulttext_high;
381
+ }
382
+ else {
383
+ return colors.color_resulttext_normal;
384
+ }
385
+ break;
386
+ default:
387
+ return colors.color_resulttext_normal;
388
+ }
389
+ }
390
+
391
+ // Profile Card
392
+
393
+ export function getProfileMainContainer(item) {
394
+ console.log('getProfileMainContainer', item);
395
+ return (
396
+ {
397
+ width: '96%',
398
+ backgroundColor: '#fff',
399
+ flexDirection: 'row',
400
+ alignItems: 'center',
401
+ borderRadius: 10, elevation: 5,
402
+ marginBottom: 5,
403
+ borderWidth: 0.1,
404
+ borderLeftWidth: 5,
405
+ borderColor: item.bordercolor ? item.bordercolor : 'lightgreen',
406
+ }
407
+ );
408
+ }
409
+ export function getProfileContentLeftlogo1(item) {
410
+ return (
411
+ {
412
+ borderRadius: 0,
413
+ // backgroundColor: "blue",
414
+ padding: 5,
415
+ color: 'black',
416
+ fontWeight: 'bold', fontSize: normalize(11),
417
+ }
418
+ );
419
+ }
420
+ export function getProfileContentLeftlogo2() {
421
+ return (
422
+ {
423
+ backgroundColor: '#fcb5b5',
424
+ padding: 5,
425
+ borderRadius: 50,
426
+ color: 'black',
427
+ fontSize: normalize(10),
428
+ }
429
+ );
430
+ }
431
+ export function getProfileContentLogo1() {
432
+ return (
433
+ {
434
+ fontSize: normalize(13),
435
+ marginTop: 3,
436
+ color: 'black',
437
+ fontWeight: 'bold',
438
+ }
439
+ );
440
+ }
441
+ export function getProfileContentLogo2() {
442
+ return (
443
+ {
444
+ fontSize: normalize(10),
445
+ color: 'black',
446
+ }
447
+ );
448
+ }
449
+ export function getProfilecardSubheadingTop(color) {
450
+ return (
451
+ {
452
+ fontSize: normalize(10),
453
+ fontWeight: fontWeight.fontWeight_700,
454
+ color: color,
455
+ // padding: 5,
456
+ paddingBottom: 0,
457
+ paddingTop: 2,
458
+ }
459
+ );
460
+ }
461
+ export function getProfilecardSubheadingBottom(color, position) {
462
+ return (
463
+ {
464
+ fontSize: normalize(10),
465
+ fontWeight: fontWeight.fontWeight_100,
466
+ color: color,
467
+ paddingLeft: position == 'right' ? 5 : 0,
468
+ paddingRight: position == 'left' ? 5 : 0,
469
+ }
470
+ );
471
+ }
472
+
473
+ export function getProfilecardMobileNO(color, position) {
474
+ return (
475
+ {
476
+ fontSize: normalize(12),
477
+ // fontWeight: fontWeight.fontWeight_100,
478
+ fontWeight: fontWeight.fontWeight_Bold,
479
+ color: color,
480
+ paddingLeft: position == 'right' ? 5 : 0,
481
+ paddingRight: position == 'left' ? 5 : 0,
482
+ }
483
+ );
484
+ }
485
+ export function getProfilecardOnlineStatusBadgeContainer(backgroundcolor) {
486
+ return (
487
+ {
488
+ backgroundColor: backgroundcolor,
489
+ height: normalize(20),
490
+ // width:normalize(28),
491
+ paddingHorizontal: normalize(5),
492
+ borderRadius: 1000,
493
+ padding: 0,
494
+ //elevation: 5,
495
+ //borderColor:backgroundcolor,
496
+ //borderWidth:1
497
+ }
498
+ );
499
+ }
500
+ export function getGroupButtonView(width) {
501
+ return (
502
+ {
503
+ justifyContent: 'center', margin: 5,
504
+ width: width * 0.10,
505
+ alignContent: 'center', alignItems: 'center',
506
+ }
507
+ );
508
+ }
509
+ export function getMediaoverlayContainerStyle(height) {
510
+ return (
511
+ {
512
+ ...ComponentStyles.mediaoverlay_containerstyle,
513
+ height: height,
514
+ }
515
+ );
516
+ }
517
+ export function getMediaViewContainer(width, height, itemwidth) {
518
+ return (
519
+ {
520
+ ...ComponentStyles.View_col_center,
521
+ width: width * (itemwidth / 100),
522
+ margin: height * 0.003,
523
+ }
524
+ );
525
+ }
526
+ export function getMediaViewChildContainer(width, itemwidth) {
527
+ return (
528
+ {
529
+ borderWidth: 0.5,
530
+ borderRadius: 2,
531
+ width: width * (itemwidth / 100),
532
+ borderColor: colors.color_componentBordercolor,
533
+ }
534
+ );
535
+ }
536
+ export function getMediaIcon(width, itemwidth) {
537
+ return (
538
+ {
539
+ height: 120,
540
+ width: width * (itemwidth / 100),
541
+ }
542
+ );
543
+ }
544
+ export function getMediaoverlayChildrenwrapperStyle(width, height, itemheight) {
545
+ return (
546
+ {
547
+ width: width,
548
+ height: itemheight,
549
+ padding: height * 0.01,
550
+ }
551
+ );
552
+ }
553
+ export function getMediaoverlayTopLineContainer(width, height) {
554
+ return (
555
+ {
556
+ ...ComponentStyles.View_col_center,
557
+ width: width * 0.15, height: height * 0.02,
558
+ }
559
+ );
560
+ }
561
+ export function getMediaoverlayOptionRow(width, height) {
562
+ return (
563
+ {
564
+ ...ComponentStyles.View_row_spacearound,
565
+ borderRadius: 14,
566
+ marginTop: height * 0.02, width: width * 0.90,
567
+ }
568
+ );
569
+ }
570
+ export function getMediaoverlayOptionContainer(width, height) {
571
+ return (
572
+ {
573
+ ...ComponentStyles.View_col_center,
574
+ margin: 5,
575
+ height: height * 0.1,
576
+ width: width * 0.20,
577
+ }
578
+ );
579
+ }
580
+ export function getMediaoverlayMsgorLoaderView(height) {
581
+ return (
582
+ {
583
+ height: height,
584
+ ...ComponentStyles.View_col_center,
585
+ }
586
+ );
587
+ }
588
+ export function getMediaGalleryChildContainer(width, height) {
589
+ return (
590
+ {
591
+ marginTop: height * 0.01, width: width * 0.90,
592
+ justifyContent: 'center', alignItems: 'center',
593
+ }
594
+ );
595
+ }
596
+ export function getMediaGalleryDeleteView(width, height) {
597
+ return (
598
+ {
599
+ borderWidth: 0.5, borderRadius: 2,
600
+ height: height / 5, width: width * 0.90,
601
+ borderColor: colors.color_componentBordercolor,
602
+ alignItems: 'center', justifyContent: 'center',
603
+ }
604
+ );
605
+ }
606
+ export function getMediaIconStyle(width, height) {
607
+ return (
608
+ {
609
+ height: height / 5, width: width * 0.90,
610
+ }
611
+ );
612
+ }
613
+ export function getMediaGalleryDeleteIcon(width) {
614
+ return (
615
+ {
616
+ height: '40%', width: width * 0.90, resizeMode: 'contain',
617
+ }
618
+ );
619
+ }
@@ -0,0 +1,101 @@
1
+ export const colors = {
2
+ color_Header: '#0E2F56',
3
+ color_dark_grey: '#606266',
4
+ color_StatusBar: '#0E2F56',
5
+ color_BorderColor: 'gray',
6
+ color_Background_color: '#ebecf0',
7
+
8
+ // Audio
9
+ color_audio_minimumTrackTintColor: '#606266',
10
+ color_audio_maximumTrackTintColor: '#de6a31',
11
+
12
+ // Profile card
13
+ color_profilecard_heading1: '#0C4F60',
14
+ color_profilecard_heading2: '#0C4F60',
15
+ color_hiddenitem_bg_color: 'lightgray',
16
+
17
+ // Error Component
18
+ color_alertCaptionText: '#0C4F60',
19
+ color_errorMoreButton: '#008de6',
20
+
21
+ // Online status
22
+ color_Status_online: '#17A589',
23
+ color_Status_offline: '#E74C3C',
24
+ color_Status_busy: '#D4AC0D',
25
+ color_MenuBorderColor: '#051094',
26
+ color_MenuText: '#0E2F56',
27
+ color_SubmenuBorderColor: '#0F52BA',
28
+ color_submenuText: '#0E4D92',
29
+ color_usernameText: '#fff',
30
+
31
+ // Button
32
+ color_button: '#4682B4',
33
+ color_buttonText: '#fff',
34
+ color_InActiveButton: 'lightgray',
35
+ color_error_msg_Text: 'red',
36
+
37
+ // Tabpage
38
+ color_tabpageBgcolor: '#fff',
39
+ color_tabpageActiveText: '#3e5877',
40
+ color_tabpageActiveTab: '#566d88',
41
+ color_tabpageInActiveText: 'gray',
42
+ color_tabpagePressColor: '#b6c0cc',
43
+ color_tabpageProfileCardBgcolor: '#ABB2B9',
44
+
45
+ // Popup
46
+ color_PopupHeadingText: '#0C4F60',
47
+ color_SelectText: '#0C4F60',
48
+ color_DeselectText: 'gray',
49
+ color_SelectBgColor: 'whitesmoke',
50
+ color_DeselectBgCOlor: '#fff',
51
+
52
+ // Radio Button
53
+ color_SelectRadioBgcolor: 'whitesmoke',
54
+ color_DeselectRadioBgcolor: 'white',
55
+ color_SelectRadioBordercolor: '#0E2F56',
56
+ colorDeselectRadioBordercolor: 'gray',
57
+ color_RadioInnerBgcolor: 'steelblue',
58
+
59
+ // Component
60
+ color_componentBgcolor: 'whitesmoke',
61
+ color_componentText: '#0C4F60',
62
+ color_componentBordercolor: '#606266',
63
+ color_BorderColor_error: '#CD5C5C',
64
+ color_editedindication_Border: '#428AF8',
65
+ color_editedindicationbgcolor: '#F1C40F',
66
+
67
+ // Template status
68
+ color_TemplateDefaultData: '#FFCAED',
69
+ color_RetrieveData: '#F24095',
70
+ color_AddData: 'aqua',
71
+ color_ClassificationData: 'gray',
72
+
73
+ // Result Report
74
+ color_resulttext_high: 'red',
75
+ color_resulttext_low: 'blue',
76
+ color_resulttext_normal: '#283747',
77
+ } as const;
78
+
79
+ /**
80
+ * Optional: typed color keys helper
81
+ */
82
+ export type ColorKeys = keyof typeof colors;
83
+
84
+ export const fontWeight = {
85
+ fontWeight_Normal: 'normal',
86
+ fontWeight_Bold: 'bold',
87
+ fontWeight_100: '100',
88
+ fontWeight_200: '200',
89
+ fontWeight_300: '300',
90
+ fontWeight_400: '400',
91
+ fontWeight_500: '500',
92
+ fontWeight_600: '600',
93
+ fontWeight_700: '700',
94
+ fontWeight_800: '800',
95
+ fontWeight_900: '900',
96
+ } as const;
97
+
98
+ /**
99
+ * Optional type helper
100
+ */
101
+ export type FontWeightKeys = keyof typeof fontWeight;