@jescon-technologies/react-native-ui-kit 0.0.3 → 0.0.5

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.
Files changed (177) hide show
  1. package/index.d.ts +66 -0
  2. package/index.js +0 -4
  3. package/package.json +3 -34
  4. package/src/Alerts/AAlert.js +3 -3
  5. package/src/Alerts/AAlertIOS.js +3 -3
  6. package/src/{common → Common}/NetworkServiceCall.js +1 -1
  7. package/src/CommonStyle/CommonTheme.js +11 -0
  8. package/src/CommonStyle/ComponentFunctions.js +632 -0
  9. package/src/CommonStyle/PopupStyle.js +146 -0
  10. package/src/CommonStyle/commonStyle.js +93 -0
  11. package/src/CommonStyle/componentStyle.js +545 -0
  12. package/src/CommonStyle/optionListStyles.js +175 -0
  13. package/src/Components/ByProductPage.js +200 -0
  14. package/src/Components/CDropDownListNew.js +153 -0
  15. package/src/Components/CSupplierList.js +88 -0
  16. package/src/Components/CVerificationCard.js +2822 -0
  17. package/src/Components/CustomButton.js +67 -0
  18. package/src/Components/CustomCard.js +127 -0
  19. package/src/Components/CustomTextInput.js +47 -0
  20. package/src/Components/EquipmentPage.js +313 -0
  21. package/src/Components/FilterInput.Copy.js +723 -0
  22. package/src/Components/FilterInput.js +569 -0
  23. package/src/Components/HSubHeading.js +68 -0
  24. package/src/Components/HeaderCard.js +40 -0
  25. package/src/Components/MoreOptionsScreen.js +251 -0
  26. package/src/Components/NonSwipableProductCard.js +226 -0
  27. package/src/Components/NonSwipableSupplierCard.js +348 -0
  28. package/src/Components/ProductCard.js +1336 -0
  29. package/src/Components/QualityProductCard.js +1059 -0
  30. package/src/Components/RateProductCard.js +1452 -0
  31. package/src/Components/RawMaterial.js +261 -0
  32. package/src/Components/SDropDownEdited.js +549 -0
  33. package/src/Components/SDropDownNew.js +529 -0
  34. package/src/Components/SHelpDescription.js +147 -0
  35. package/src/Components/STextInputNew.js +510 -0
  36. package/src/Components/SearchProductCard.js +470 -0
  37. package/src/Components/StageByProduct.js +199 -0
  38. package/src/Components/SupplierCard.js +243 -0
  39. package/src/Components/SupplierInvoiceCard.js +405 -0
  40. package/src/Components/SwipableSupplierCard.js +136 -0
  41. package/src/Components/TagTemplate.js +74 -0
  42. package/src/Components/WrappedComponent.js +25 -0
  43. package/src/Custom/CBooking.js +944 -0
  44. package/src/Custom/CBookingPostpone.js +1822 -0
  45. package/src/Custom/CCalendar.js +560 -0
  46. package/src/Custom/CCard.js +880 -0
  47. package/src/Custom/CDetailCard.js +205 -0
  48. package/src/Custom/CHelpImage.js +52 -0
  49. package/src/Custom/CReport.js +569 -0
  50. package/src/Custom/CScrollView.js +73 -0
  51. package/src/Custom/CSignature.js +112 -0
  52. package/src/Custom/CSliderMenu.js +339 -0
  53. package/src/Custom/CSupplierCard.js +99 -0
  54. package/src/Custom/CTemplateCard.js +438 -0
  55. package/src/Custom/CTokenAllocation.js +1402 -0
  56. package/src/Custom/CTokenListOverlay.js +122 -0
  57. package/src/Custom/CWardStatus.js +444 -0
  58. package/src/Custom/Charts/CBarChart.js +218 -0
  59. package/src/Custom/Charts/CDashBoardList.js +133 -0
  60. package/src/Custom/Charts/CDashBoardTable.js +172 -0
  61. package/src/Custom/Charts/CLineChart.js +193 -0
  62. package/src/Custom/Charts/CPieChart.js +186 -0
  63. package/src/Custom/Loader.js +182 -0
  64. package/src/Custom/OUserView.js +1121 -0
  65. package/src/Custom/PreviewDosage.js +115 -0
  66. package/src/Custom/SearchLoader.js +32 -0
  67. package/src/Custom/TableComponent/CActivityTable.js +707 -0
  68. package/src/Custom/TableComponent/CMoreButtonTable.js +197 -0
  69. package/src/Custom/TableComponent/CTable.js +185 -0
  70. package/src/Custom/TableComponent/CTextBody.js +40 -0
  71. package/src/Custom/TableComponent/CTextHeader.js +17 -0
  72. package/src/Custom/TableComponent/PreviewPrescriptionNew.js +1011 -0
  73. package/src/Custom/TableComponent/SDropdownTable.js +491 -0
  74. package/src/Custom/TableComponent/TagTable.js +1200 -0
  75. package/src/CustomComponents/CAddColumn.js +140 -0
  76. package/src/CustomComponents/CAssessmentDelete.js +307 -0
  77. package/src/CustomComponents/CAwesomeButton.js +83 -0
  78. package/src/CustomComponents/CAwesomeMoreButton.js +54 -0
  79. package/src/CustomComponents/CBackHandler.js +273 -0
  80. package/src/CustomComponents/CCalendar.js +243 -0
  81. package/src/CustomComponents/CCommentOverlay.js +202 -0
  82. package/src/CustomComponents/CComments.js +162 -0
  83. package/src/CustomComponents/CContainerView.js +24 -0
  84. package/src/CustomComponents/CCustomTextInput.js +336 -0
  85. package/src/CustomComponents/CDetailView.js +40 -0
  86. package/src/CustomComponents/CDropDownList.js +153 -0
  87. package/src/CustomComponents/CDropdownSelect.js +555 -0
  88. package/src/CustomComponents/CFooterView.js +42 -0
  89. package/src/CustomComponents/CImagePickerSave.js +316 -0
  90. package/src/CustomComponents/CModalOverlay.js +91 -0
  91. package/src/CustomComponents/CNetworkStatus.js +327 -0
  92. package/src/CustomComponents/CNotesInstructions.js +1000 -0
  93. package/src/CustomComponents/COverlay.js +81 -0
  94. package/src/CustomComponents/CRemarks.js +176 -0
  95. package/src/CustomComponents/CRowAdd.js +143 -0
  96. package/src/CustomComponents/CSummaryDropDown.js +327 -0
  97. package/src/CustomComponents/CText.js +9 -0
  98. package/src/CustomComponents/CVectorIcon.js +34 -0
  99. package/src/CustomComponents/HtmlContentViewer.js +65 -0
  100. package/src/CustomComponents/PdfContentViewer.js +90 -0
  101. package/src/CustomComponents/SDropDownDosage.js +1087 -0
  102. package/src/CustomComponents/SwipableProductCard.js +246 -0
  103. package/src/CustomComponents/SwipableProductImageCard.js +254 -0
  104. package/src/CustomComponents/WorkOrderDetails.js +1216 -0
  105. package/src/CustomComponents/WorkOrderDetailsPage.js +1213 -0
  106. package/src/HOC/ConfirmOverlay.js +2 -2
  107. package/src/HOC/HMoreButton.js +1 -1
  108. package/src/HOC/HNatureHeading.js +1 -1
  109. package/src/HOC/HShadowButton.js +1 -1
  110. package/src/HOC/HShadowCountButton.js +1 -1
  111. package/src/Json/Chart.json +818 -0
  112. package/src/Json/Consultation.json +622 -0
  113. package/src/Json/CreditBill.json +490 -0
  114. package/src/Json/Dropdown.json +216 -0
  115. package/src/Json/DropdownConsultation.json +228 -0
  116. package/src/Json/DynamicReports.json +623 -0
  117. package/src/Json/Footer.json +79 -0
  118. package/src/Media/AudioScreen.js +2 -7
  119. package/src/Media/CCaptureImageWithoutEdit.js +1 -1
  120. package/src/Media/CImageGallery.js +2 -2
  121. package/src/Media/CSingleImage.js +2 -2
  122. package/src/Media/CVideoPlay.js +1 -1
  123. package/src/Media/DocumentScreen.js +2 -7
  124. package/src/Media/DrawingScreen.js +2 -6
  125. package/src/Media/ImageScreen.js +2 -6
  126. package/src/Media/VideoScreen.js +2 -7
  127. package/src/Navigation/PageNavigation.js +224 -0
  128. package/src/Navigation/useFocusEffect.js +2 -0
  129. package/src/Navigation/useFocusEffect.native.js +1 -0
  130. package/src/Navigation/useFocusEffect.web.js +1 -0
  131. package/src/Navigation/useIsFocused.js +1 -0
  132. package/src/Navigation/useIsFocused.native.js +1 -0
  133. package/src/Navigation/useIsFocused.web.js +1 -0
  134. package/src/Navigation/useNavigation.js +2 -0
  135. package/src/Navigation/useNavigation.native.js +1 -0
  136. package/src/Navigation/useNavigation.web.js +1 -0
  137. package/src/Screens/CMedications.js +528 -0
  138. package/src/Screens/CWebViewGallery.js +203 -0
  139. package/src/Screens/ChartScan.js +279 -0
  140. package/src/Screens/ChartScreenNew.js +1579 -0
  141. package/src/Screens/Consultation.js +1500 -0
  142. package/src/Screens/Dashboard.js +778 -0
  143. package/src/Screens/FileExplorer.js +288 -0
  144. package/src/Screens/Footer.js +340 -0
  145. package/src/Screens/ForgotPassword.js +288 -0
  146. package/src/Screens/HeaderBlock.js +353 -0
  147. package/src/Screens/Login.js +328 -0
  148. package/src/Screens/Notification.js +149 -0
  149. package/src/Screens/OcrScreen.js +20 -0
  150. package/src/Screens/PdfPreview.js +507 -0
  151. package/src/Screens/RegistrationDetails.js +467 -0
  152. package/src/Screens/SearchScreen.js +582 -0
  153. package/src/Screens/Splash.js +788 -0
  154. package/src/Screens/SwipeLeftView.js +1867 -0
  155. package/src/StaticComponents/SDatePickerLabel.js +1 -1
  156. package/src/StaticComponents/SDatePickerNew.js +1 -1
  157. package/src/StaticComponents/SDateTimePickerNew.js +2 -2
  158. package/src/StaticComponents/SDropDownGenerate.js +3 -3
  159. package/src/StaticComponents/SDropDownHoc.js +4 -4
  160. package/src/StaticComponents/SDropDownIcon.js +1 -1
  161. package/src/StaticComponents/SMenuBox.js +2 -2
  162. package/src/StaticComponents/SSearch.js +2 -2
  163. package/src/StaticComponents/STextInput.js +1 -1
  164. package/src/StaticComponents/STimePicker.js +1 -1
  165. package/src/StaticComponents/STimingDropDownNew.js +2 -6
  166. package/src/StaticComponents/STimingSwitch.js +1 -1
  167. package/src/layout/CContainerView.js +1 -1
  168. package/src/layout/CDetailView.js +3 -3
  169. package/src/layout/HeaderBlock.js +5 -5
  170. package/src/layout/INVLoginLayout.js +3 -4
  171. package/src/layout/Loader.js +2 -2
  172. package/src/HOC/HAbsolute.js +0 -56
  173. package/src/HOC/HDiscontinue.js +0 -105
  174. package/src/HOC/HOverlay.js +0 -99
  175. package/src/layout/FooterBlock.js +0 -821
  176. /package/src/{common → Common}/ErrorBoundary.tsx +0 -0
  177. /package/src/{common → Common}/Icons.js +0 -0
@@ -0,0 +1,193 @@
1
+ import React, { useState } from 'react';
2
+ import { Defs, LinearGradient, Stop } from 'react-native-svg';
3
+ import { View, Dimensions, TouchableOpacity, Platform } from 'react-native';
4
+ import { LineChart, Grid, XAxis, YAxis } from 'react-native-svg-charts';
5
+ import { Circle, G, Line, Rect, Text } from 'react-native-svg';
6
+ import CText from '../../CustomComponents/CText';
7
+ import moment from 'moment';
8
+ import SDatePickerNew from '../../StaticComponents/SDatePickerNew';
9
+ import { normalize } from '../../CommonStyle/componentStyle';
10
+ import { ScrollView } from 'react-native';
11
+ import { ArrayCheck, isBNUL, ValueCheck } from '../../CommonStyle/ComponentFunctions';
12
+
13
+
14
+ export default function CLineChart(props) {
15
+
16
+ const [index, setIndex] = useState(1);
17
+ const [propsData, setPropsData] = useState(props.data);
18
+ const [data, setData] = useState(isBNUL(propsData) ? (propsData).map(({ value }) => parseFloat(value)) : []);
19
+ const axesSvg = { fontSize: normalize(11), fill: 'grey' };
20
+ const verticalContentInset = { top: 5, bottom: 5 };
21
+ const xAxisHeight = 30;
22
+
23
+ const Gradient = () => (
24
+ <Defs key={'gradient'}>
25
+ <LinearGradient id={'gradient'} x1={'0'} y={'0%'} x2={'100%'} y2={'0%'}>
26
+ <Stop offset={'0%'} stopColor={'rgb(134, 65, 244)'} />
27
+ <Stop offset={'100%'} stopColor={'rgb(66, 194, 244)'} />
28
+ </LinearGradient>
29
+ </Defs>
30
+ );
31
+
32
+ const Tooltip = ({ x, y }) => (
33
+
34
+ propsData[index] != undefined ?
35
+ <G
36
+ x={10}
37
+ key={'tooltip'}
38
+ onPress={() => console.log('tooltip clicked')}
39
+ >
40
+ <G y={50}>
41
+ <Rect
42
+ height={normalize(30)}
43
+ width={normalize(70)}
44
+ stroke={'grey'}
45
+ fill={'white'}
46
+ ry={10}
47
+ rx={10}
48
+ />
49
+ <Text
50
+ x={75 / 2}
51
+ dy={normalize(10)}
52
+ alignmentBaseline={'middle'}
53
+ textAnchor={'middle'}
54
+ stroke={'rgb(134, 65, 244)'}
55
+ >
56
+ {`${data[index]}`}
57
+ </Text>
58
+
59
+ <Text
60
+ x={75 / 2}
61
+ dy={normalize(25)}
62
+ alignmentBaseline={'middle'}
63
+ textAnchor={'middle'}
64
+ stroke={'rgb(134, 65, 244)'}
65
+ fontSize={'7'}
66
+ >
67
+ {`${propsData[index].date}`}
68
+ </Text>
69
+ </G>
70
+ <G x={75 / 2}>
71
+ <Circle
72
+ cy={y(data[index])}
73
+ r={6}
74
+ stroke={'rgb(134, 65, 244)'}
75
+ strokeWidth={2}
76
+ fill={'white'}
77
+ />
78
+ </G>
79
+ </G> : null
80
+ );
81
+
82
+ const Decorator = ({ x, y, data }) => {
83
+ return data.map((value, index) => (
84
+ <Circle
85
+ onPress={() => setIndex(index)}
86
+ key={index}
87
+ cx={x(index)}
88
+ cy={y(value)}
89
+ r={6}
90
+ stroke={'rgb(134, 65, 244)'}
91
+ fill={'white'}
92
+ />
93
+ ));
94
+ };
95
+
96
+ return (
97
+ data != null && data != undefined && data.length > 0 ?
98
+ <>
99
+ <View style={{ alignItems: 'flex-start', borderWidth: 0, borderColor: 'green', backgroundColor: 'white' }}>
100
+ <View style={{ flexDirection: 'row', borderWidth: 0 }}>
101
+ <YAxis
102
+ data={data}
103
+ style={{ borderWidth: 0 }}
104
+ contentInset={verticalContentInset}
105
+ svg={axesSvg}
106
+ />
107
+ <View style={{ flex: 1, borderWidth: 0 }}>
108
+ <LineChart
109
+ style={{ height: normalize(150) }}
110
+ data={data}
111
+ contentInset={{ top: normalize(10), bottom: normalize(10), left: normalize(10), right: normalize(10) }}
112
+ svg={{
113
+ strokeWidth: normalize(3),
114
+ stroke: 'url(#gradient)',
115
+ }}
116
+ >
117
+ <Grid
118
+ direction="HORIZONTAL"
119
+ // direction='VERTICAL'
120
+ />
121
+ <Gradient />
122
+ {/* <Tooltip /> */}
123
+ <Decorator />
124
+ </LineChart>
125
+ </View>
126
+ </View>
127
+ <XAxis
128
+ style={{ marginHorizontal: 0, height: normalize(55), borderWidth: 0, width: '100%' }}
129
+ data={propsData}
130
+ formatLabel={(value, index) => propsData[index].displayvalue}
131
+ contentInset={{ left: normalize(20), right: normalize(10)}}
132
+ svg={{ fontSize: normalize(7), fontWeight: 'bold', fill: 'black', translateY: normalize(15), rotation: normalize(75), originY: 0 }}
133
+ />
134
+ </View>
135
+ </>
136
+ : null
137
+ );
138
+ }
139
+
140
+
141
+ {/* <CLinechart
142
+ component={Line}
143
+ data={Line.data}
144
+ /> */}
145
+
146
+
147
+ // var Line = {
148
+ // "keyid": 3,
149
+ // "customcomponent": "CLinechart",
150
+ // "heading": "JULY",
151
+ // "data": [
152
+ // {
153
+ // "value": 220,
154
+ // "display": "JUL 18"
155
+ // },
156
+ // {
157
+ // "value": 189,
158
+ // "display": "JUL 17"
159
+ // },
160
+ // {
161
+ // "value": 178,
162
+ // "display": "JUL 16"
163
+ // },
164
+ // {
165
+ // "value": 170,
166
+ // "display": "JUL 15"
167
+ // },
168
+ // {
169
+ // "value": 156,
170
+ // "display": "JUL 14"
171
+ // },
172
+ // {
173
+ // "value": 196,
174
+ // "display": "JUL 13"
175
+ // },
176
+ // {
177
+ // "value": 122,
178
+ // "display": "JUL 12"
179
+ // },
180
+ // {
181
+ // "value": 139,
182
+ // "display": "JUL 11"
183
+ // },
184
+ // {
185
+ // "value": 167,
186
+ // "display": "JUL 10"
187
+ // },
188
+ // {
189
+ // "value": 145,
190
+ // "display": "JUL 09"
191
+ // }
192
+ // ]
193
+ // }
@@ -0,0 +1,186 @@
1
+ import React, { useEffect, useState } from 'react';
2
+ import { Dimensions, View, Text as RNText, TouchableOpacity, Platform } from 'react-native';
3
+ import { PieChart } from 'react-native-svg-charts';
4
+ import { Circle, G, Line, Text } from 'react-native-svg';
5
+ import CText from '../../CustomComponents/CText';
6
+ import moment from 'moment';
7
+ import SDatePickerNew from '../../StaticComponents/SDatePickerNew';
8
+ import { normalize } from '../../CommonStyle/componentStyle';
9
+
10
+ export default function CPiechart(props) {
11
+ const [data, setData] = useState(props.data);
12
+ // console.log(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>",props.data)
13
+ const [Nested, setNested] = useState(false);
14
+ const [visibility, setVisibility] = useState(true);
15
+ const [colorcode, setColorCode] = useState(props.colorArr != undefined && props.colorArr != null ? (props.colorArr).filter(word => word != undefined) : null);
16
+ const [styles, setStyles] = useState(props.style != undefined ? props.style : {
17
+ 'innerRadius': normalize(52),
18
+ 'outerRadius': normalize(30),
19
+ 'labelRadius': normalize(70),
20
+ 'height': 0.35,
21
+ });
22
+ const pieData =
23
+ data != undefined && data.filter(value => value.value > 0)
24
+ .map((value, index) => ({
25
+ value: value.value,
26
+ svg: { fill: colorcode != undefined ? colorcode[index] : getPieColor(index) },
27
+ key: `pie-${index}`,
28
+ }));
29
+
30
+ function getDateWisePieChart(params) {
31
+ setData([
32
+ {
33
+ 'value': 33,
34
+ 'display': '2022',
35
+ },
36
+ {
37
+ 'value': 29,
38
+ 'display': '2021',
39
+ },
40
+ ]);
41
+ }
42
+ const Labels = ({ slices }) => {
43
+ return slices.map((slice, index) => {
44
+ const { labelCentroid, pieCentroid, data } = slice;
45
+ return (
46
+ <G key={index}>
47
+ <Line
48
+ x1={labelCentroid[0]}
49
+ y1={labelCentroid[1]}
50
+ x2={pieCentroid[0]}
51
+ y2={pieCentroid[1]}
52
+ stroke={data.svg.fill}
53
+ />
54
+
55
+ <G x={labelCentroid[0]} y={labelCentroid[1]}>
56
+ <Circle r={normalize(13)} fill={data.svg.fill} />
57
+ <Circle r={normalize(11)} fill={'white'} />
58
+ <Text
59
+ key={index}
60
+ x={-0.5}
61
+ y={1.5}
62
+ fill={'black'}
63
+ textAnchor={'middle'}
64
+ alignmentBaseline={'middle'}
65
+ fontSize={normalize(10)}
66
+ fontWeight={'bolder'}
67
+ stroke={'white'}
68
+ opacity={'1'}
69
+ strokeWidth={0.4}>
70
+ {data.value}
71
+ </Text>
72
+ </G>
73
+ </G>
74
+ );
75
+ });
76
+ };
77
+
78
+ function getPreviousInfo() {
79
+ setNested(true);
80
+ }
81
+
82
+ return (
83
+ pieData.length > 0 && visibility ?
84
+ <View style={{}}>
85
+ {Nested ?
86
+ <CText>KKK</CText> : null}
87
+
88
+ <View style={{ paddingVertical: 0, marginTop: 0 }}>
89
+
90
+ {props.component != undefined ?
91
+ <View style={{ justifyContent: 'space-between', flexDirection: 'row' }}>
92
+ <CText style={{ fontSize: normalize(15), paddingHorizontal: 5, fontWeight: 'bold', color: 'black' }}>{props.component != undefined ? props.component.heading : ''}</CText>
93
+ </View> : null}
94
+
95
+ {props.component != undefined && props.component.date != undefined ?
96
+ <View>
97
+ <SDatePickerNew
98
+ callBack={val => (val == undefined ? null : getDateWisePieChart(val))} />
99
+ </View> : null}
100
+
101
+ <View style={{ flexDirection: 'row', alignItems: 'center'}}>
102
+ <View style={{ flexDirection: 'row' }}>
103
+ <PieChart
104
+ style={{
105
+ marginTop:normalize(-8),
106
+ height: Dimensions.get('screen').height *
107
+ (styles.height), width: Dimensions.get('screen').width * 0.6,
108
+ }}
109
+ data={pieData}
110
+ innerRadius={normalize(styles.innerRadius)}
111
+ outerRadius={normalize(styles.outerRadius)}
112
+ labelRadius={normalize(styles.labelRadius)}
113
+ >
114
+ <Labels />
115
+ </PieChart>
116
+ </View>
117
+
118
+ {/* <View style={{ paddingLeft: 15 }}>
119
+ {data != undefined ? data.map((display, p) => {
120
+ return (
121
+ display != null && display != undefined ?
122
+ <View key={p} style={{ flexDirection: 'row', alignItems: 'center', paddingVertical: normalize(4) }}>
123
+ <View style={{
124
+ paddingVertical: normalize(5), paddingHorizontal: normalize(4),
125
+ backgroundColor: getPieColor(p), borderRadius: 5, alignItems: 'center', justifyContent: 'center',
126
+ marginRight: 5
127
+ }}>
128
+ <CText style={{ fontSize: normalize(12), color: 'black', fontWeight: 'bold', color: 'white' }}>{display.value}</CText>
129
+ </View>
130
+ <CText style={{ fontSize: normalize(12), color: 'black', fontWeight: '500' }}>{display.display}</CText>
131
+ </View> : null)
132
+ }) : null}
133
+ </View> */}
134
+ </View>
135
+ </View>
136
+ </View> : null
137
+ );
138
+ function getPieColor(params) {
139
+ switch (params) {
140
+ case 0: return 'blue';
141
+ case 1: return 'green';
142
+ case 2: return '#cf0404';
143
+ case 3: return '#24bfde';
144
+ case 4: return '#7b36bc';
145
+ case 5: return '#f28909';
146
+ case 6: return '#0cd3cd';
147
+ case 7: return '#ad400a';
148
+ default: return 'black';
149
+ }
150
+ }
151
+ }
152
+
153
+ {/* <CPiechart
154
+ component={PieChart}
155
+ data={PieChart.data}
156
+ style={{
157
+ "innerRadius": normalize(52),
158
+ "outerRadius": normalize(30),
159
+ "labelRadius": normalize(70),
160
+ "height": 0.27
161
+ }} /> */}
162
+
163
+ // var PieChart = {
164
+ // "keyid": 3,
165
+ // "customcomponent": "CPiechart",
166
+ // "heading": "Monthly Profit",
167
+ // // "date": "2021-03-01",
168
+ // "data": [
169
+ // {
170
+ // "value": 23,
171
+ // "display": "JANUVARY"
172
+ // },
173
+ // {
174
+ // "value": 35,
175
+ // "display": "FEBRUVARY"
176
+ // },
177
+ // {
178
+ // "value": 40,
179
+ // "display": "MARCH"
180
+ // },
181
+ // {
182
+ // "value": 87,
183
+ // "display": "APRIL"
184
+ // }
185
+ // ]
186
+ // }
@@ -0,0 +1,182 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import {
3
+ StyleSheet,
4
+ Dimensions,
5
+ View,
6
+ Modal,
7
+ Animated,
8
+ Easing,
9
+ Text,
10
+ Image,
11
+ Platform,
12
+ } from 'react-native';
13
+ import { normalize } from '../CommonStyle/componentStyle';
14
+ import { APIURL } from '../../../../../src/Common/apiConstants';
15
+
16
+ export default function Loader({
17
+ visible = true,
18
+ overlayColor = 'rgba(0,0,0,0.4)',
19
+ loaderColor = 'lightblue',
20
+ size = Platform.OS !== 'web' ? 30 : 50,
21
+ gifSource = { uri: `${APIURL}file/getCommonFile/image/heartpulse.gif` },
22
+ message = '',
23
+ messageStyle = {},
24
+ animationType = 'fade',
25
+ hasBackground = true,
26
+ borderRadius = 20,
27
+ shadow = true,
28
+ }) {
29
+ const [rotation] = useState(new Animated.Value(0));
30
+ const [pulse] = useState(new Animated.Value(1));
31
+ const [fade] = useState(new Animated.Value(0));
32
+
33
+ // Rotation animation
34
+ useEffect(() => {
35
+ if (!gifSource) { // Only animate if not using a GIF
36
+ Animated.loop(
37
+ Animated.timing(rotation, {
38
+ toValue: 1,
39
+ duration: 1500,
40
+ easing: Easing.linear,
41
+ useNativeDriver: true,
42
+ })
43
+ ).start();
44
+ }
45
+
46
+ // Pulse animation
47
+ Animated.loop(
48
+ Animated.sequence([
49
+ Animated.timing(pulse, {
50
+ toValue: 1.1,
51
+ duration: 800,
52
+ useNativeDriver: true,
53
+ }),
54
+ Animated.timing(pulse, {
55
+ toValue: 1,
56
+ duration: 800,
57
+ useNativeDriver: true,
58
+ }),
59
+ ])
60
+ ).start();
61
+
62
+ // Fade in animation
63
+ Animated.timing(fade, {
64
+ toValue: 1,
65
+ duration: 300,
66
+ useNativeDriver: true,
67
+ }).start();
68
+ }, []);
69
+
70
+ const spin = rotation.interpolate({
71
+ inputRange: [0, 1],
72
+ outputRange: ['0deg', '360deg'],
73
+ });
74
+
75
+ const loaderContent = gifSource ? (
76
+ <Image
77
+ style={[styles.icon_style, { width: normalize(size), height: normalize(size) }]}
78
+ source={gifSource}
79
+ resizeMode="contain"
80
+ />
81
+ ) : (
82
+ <Animated.View style={[
83
+ styles.defaultLoader,
84
+ {
85
+ borderColor: loaderColor,
86
+ transform: [{ rotate: spin }, { scale: pulse }],
87
+ width: normalize(size),
88
+ height: normalize(size),
89
+ borderWidth: normalize(size / 10),
90
+ },
91
+ ]}>
92
+ <View style={[
93
+ styles.innerCircle,
94
+ {
95
+ backgroundColor: loaderColor,
96
+ width: normalize(size / 2),
97
+ height: normalize(size / 2),
98
+ },
99
+ ]} />
100
+ </Animated.View>
101
+ );
102
+
103
+
104
+
105
+
106
+ return (
107
+ <Modal
108
+ animationType={animationType}
109
+ transparent={true}
110
+ visible={visible}
111
+ onRequestClose={() => { }}
112
+ >
113
+ <Animated.View style={[
114
+ styles.modalContainer,
115
+ {
116
+ backgroundColor: overlayColor,
117
+ opacity: fade,
118
+ },
119
+ ]}>
120
+ <Animated.View style={[
121
+ styles.loaderContainer,
122
+ {
123
+ backgroundColor: hasBackground ? 'white' : 'transparent',
124
+ borderRadius: normalize(borderRadius),
125
+ transform: [{ scale: pulse }],
126
+ ...(shadow && styles.shadowStyle),
127
+ },
128
+ ]}>
129
+ {loaderContent}
130
+ {message ? (
131
+ <Text style={[styles.messageText, messageStyle]}>
132
+ {message}
133
+ </Text>
134
+ ) : null}
135
+ </Animated.View>
136
+ </Animated.View>
137
+ </Modal>
138
+ );
139
+ }
140
+
141
+ const styles = StyleSheet.create({
142
+
143
+
144
+ modalContainer: {
145
+ flex: 1,
146
+ justifyContent: 'center',
147
+ alignItems: 'center',
148
+ },
149
+ loaderContainer: {
150
+ padding: normalize(20),
151
+ justifyContent: 'center',
152
+ alignItems: 'center',
153
+ },
154
+ icon_style: {
155
+ justifyContent: 'center',
156
+ alignItems: 'center',
157
+ },
158
+ defaultLoader: {
159
+ borderRadius: normalize(100),
160
+ justifyContent: 'center',
161
+ alignItems: 'center',
162
+ },
163
+ innerCircle: {
164
+ borderRadius: normalize(100),
165
+ },
166
+ messageText: {
167
+ marginTop: normalize(15),
168
+ fontSize: normalize(14),
169
+ color: '#555',
170
+ textAlign: 'center',
171
+ },
172
+ shadowStyle: {
173
+ shadowColor: '#000',
174
+ shadowOffset: {
175
+ width: 0,
176
+ height: 2,
177
+ },
178
+ shadowOpacity: 0.25,
179
+ shadowRadius: 3.84,
180
+ elevation: 5,
181
+ },
182
+ });