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

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 (59) hide show
  1. package/index.js +70 -0
  2. package/package.json +25 -3
  3. package/src/Alerts/AAlert.js +1 -1
  4. package/src/HOC/ConfirmOverlay.js +192 -0
  5. package/src/HOC/HAbsolute.js +56 -0
  6. package/src/HOC/HDiscontinue.js +105 -0
  7. package/src/HOC/HHeading.js +70 -0
  8. package/src/HOC/HMoreButton.js +88 -0
  9. package/src/HOC/HNatureHeading.js +402 -0
  10. package/src/HOC/HOCIcons.js +80 -0
  11. package/src/HOC/HOverlay.js +99 -0
  12. package/src/HOC/HOverlayCentered.js +140 -0
  13. package/src/HOC/HShadowButton.js +45 -0
  14. package/src/HOC/HShadowCountButton.js +82 -0
  15. package/src/HOC/OptionOverlay.js +48 -0
  16. package/src/Media/AudioScreen.js +347 -0
  17. package/src/Media/BarcodeScan.js +145 -0
  18. package/src/Media/CAudioPlay.js +228 -0
  19. package/src/Media/CCaptureImageWithoutEdit.js +330 -0
  20. package/src/Media/CImageGallery.js +289 -0
  21. package/src/Media/CImageZoom.js +82 -0
  22. package/src/Media/CSingleImage.js +391 -0
  23. package/src/Media/CSketchCanvas.js +76 -0
  24. package/src/Media/CVideoPlay.js +31 -0
  25. package/src/Media/DocumentScreen.js +367 -0
  26. package/src/Media/DrawingScreen.js +582 -0
  27. package/src/Media/ImageScreen.js +313 -0
  28. package/src/Media/RecordAudio.js +250 -0
  29. package/src/Media/RecordVideo.js +223 -0
  30. package/src/Media/VideoScreen.js +383 -0
  31. package/src/StaticComponents/SAlphabet.js +47 -0
  32. package/src/StaticComponents/SCheckBox.js +42 -0
  33. package/src/StaticComponents/SDatePicker.js +208 -0
  34. package/src/StaticComponents/SDatePickerLabel.js +253 -0
  35. package/src/StaticComponents/SDatePickerNew.js +258 -0
  36. package/src/StaticComponents/SDateTimePickerNew.js +381 -0
  37. package/src/StaticComponents/SDropDownGenerate.js +450 -0
  38. package/src/StaticComponents/SDropDownHoc.js +636 -0
  39. package/src/StaticComponents/SDropDownIcon.js +500 -0
  40. package/src/StaticComponents/SMenuBox.js +131 -0
  41. package/src/StaticComponents/SOverlay.js +177 -0
  42. package/src/StaticComponents/SOverlayTextInput.js +109 -0
  43. package/src/StaticComponents/SSearch.js +438 -0
  44. package/src/StaticComponents/SSearchBar.js +53 -0
  45. package/src/StaticComponents/SSpeedDial.js +303 -0
  46. package/src/StaticComponents/STextInput.js +289 -0
  47. package/src/StaticComponents/STextInputProps.js +36 -0
  48. package/src/StaticComponents/STimePicker.js +171 -0
  49. package/src/StaticComponents/STimingDropDownNew.js +1589 -0
  50. package/src/StaticComponents/STimingSwitch.js +34 -0
  51. package/src/layout/CContainerView.js +21 -0
  52. package/src/layout/CDetailView.js +81 -0
  53. package/src/layout/FooterBlock.js +0 -3
  54. package/src/layout/HeaderBlock.js +353 -0
  55. package/src/index.js +0 -15
  56. package/src/screens/ForgotPassword.js +0 -346
  57. package/src/screens/Login.js +0 -328
  58. package/src/screens/Splash.js +0 -788
  59. /package/src/{components → layout}/Loader.js +0 -0
@@ -0,0 +1,450 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import { TouchableOpacity, StyleSheet, View, TouchableHighlight, Text, Image, TextInput, ScrollView, FlatList } from 'react-native';
3
+ import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
4
+ import ComponentStyles, { height, normalize } from '../CommonStyle/componentStyle';
5
+ import popupStyles, {
6
+ getListviewItem,
7
+ getListviewItemText,
8
+ } from '../CommonStyle/PopupStyle';
9
+ import { APIURL } from '../Common/apiConstants';
10
+ import { Dimensions } from 'react-native';
11
+ import SearchLoader from '../Custom/SearchLoader';
12
+ import AntDesign from 'react-native-vector-icons/AntDesign';
13
+ import SAlphabet from './SAlphabet';
14
+ import Icons from '../Common/Icons';
15
+ import { Global } from '../Common/Global';
16
+ import { ValueCheck, isNU, notifyMessage } from '../CommonStyle/ComponentFunctions';
17
+ import HOCIcons from '../HOC/HOCIcons';
18
+ import CModalOverlay from '../CustomComponents/CModalOverlay';
19
+
20
+ var searchResult = [];
21
+ var tempvalue = [];
22
+ var ValueString = null;
23
+ const SDropDownGenerate = (props) => {
24
+ const [isdropdownshow, setDropdownShow] = useState(false);
25
+ const [searchData, setSearchData] = useState('');
26
+ const [isLoading, setIsLoading] = useState(true);
27
+ const [selectedValue, setSelectedValue] = useState(props.value);
28
+ const [displayData, setDisplayData] = useState([]);
29
+ const [stage, setStage] = useState(false);
30
+ const [refresh, setRefresh] = useState(0);
31
+ const [filterPurpose, setFilterPurpose] = useState([]);
32
+ const [alphaFilter, setAlphaFilter] = useState(false);
33
+ const [dropdowndata, setDropDownData] = useState(props.dropdowndata);
34
+ const PropStyles = {
35
+ 'overlayheight': ValueCheck(props.height) ? props.height : 0.2,
36
+ 'overlayborderRadius': ValueCheck(props.height) ? 0 : 20,
37
+ };
38
+ function getOverlayScreenContainer() {
39
+ return ({
40
+ flexDirection: 'row',
41
+ margin: normalize(5),
42
+ });
43
+ }
44
+
45
+ useEffect(() => {
46
+ setAlphaFilter(false);
47
+ });
48
+
49
+
50
+ function FetchDropdownList(key) {
51
+ setSearchData('');
52
+ setIsLoading(true);
53
+ setDropdownShow(true);
54
+ console.log('JJJJJJJMMMMMMMMMHHHHHHHHHHHHHHHHH1', APIURL + props.dropdownapi);
55
+ NetworkServiceCall('get', APIURL + props.dropdownapi, '')
56
+ .then(function (response) {
57
+ if (response.data.data != null && response.data.data != undefined) {
58
+ searchResult = response;
59
+ setDisplayData(response.data.data);
60
+ setIsLoading(false);
61
+ }
62
+ else {
63
+ searchResult = [];
64
+ setDisplayData([]);
65
+ setIsLoading(false);
66
+ }
67
+ });
68
+ }
69
+
70
+ function FetchList() {
71
+ setSearchData('');
72
+ setIsLoading(true);
73
+ setDropdownShow(true);
74
+ searchResult = { 'httpstatus': 200 };
75
+ setDisplayData(props.dropdownarray);
76
+ setIsLoading(false);
77
+ }
78
+
79
+ function selection(item, changevalue, keycode) {
80
+ let dataset = {
81
+ ...item,
82
+ // "datavalue": item.datavalue,
83
+ // "displayvalue": item.displayvalue,
84
+ // "key": keycode
85
+ };
86
+ setDropDownData(item.displayvalue);
87
+ props.stewardship != undefined && props.stewardship ? props.onChangeData(item) : props.onChangeData(dataset);
88
+ props.refreshCount(1);
89
+ // props.editStatus(1)
90
+ setDropdownShow(false);
91
+ }
92
+
93
+ function getFooterFunctions() {
94
+ // Prepare data for saving
95
+ var groups = {
96
+ option: 'insustbatch1',
97
+ // userdata: Global.userData,
98
+ insuproduct: props?.productcode,
99
+ hrenemp: Global.userData.hrenemp,
100
+ };
101
+ var dataset = { groups };
102
+
103
+ console.log('savedataaaaaaaaaaa', JSON.stringify(dataset));
104
+
105
+ if (groups.insuproduct != undefined) {
106
+ let buttonapi = `${APIURL}invsave/FlCommonSave`;
107
+ console.log('buttonapi>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>', buttonapi);
108
+ NetworkServiceCall('post', buttonapi, dataset).then(function (response) {
109
+ if (response.httpstatus == 200) {
110
+ if (response.data.code == 101) {
111
+ notifyMessage('Batch already exists');
112
+ } else {
113
+ notifyMessage('Batch Created');
114
+ // props.editable ? FetchDropdownList() : FetchList()
115
+ if (props.refreshCount) {props.refreshCount();} // <-- Call parent refresh
116
+ setDropdownShow(false);
117
+ }
118
+ }
119
+ });
120
+ } else {
121
+ notifyMessage('Product not selected');
122
+ }
123
+ }
124
+
125
+ function DropdownLayout() {
126
+ return (
127
+ <View style={layoutstyles.overlay_screen_container}>
128
+ <View style={{ alignItems: 'center' }}>
129
+ <Text style={{ fontSize: normalize(12), fontWeight: 'normal', color: Global.AppTheme.primary_color }}> SELECT OPTION </Text>
130
+ </View>
131
+
132
+ <View style={getOverlayScreenContainer()}>
133
+ <View
134
+ style={[ComponentStyles.searchTextbox_View,
135
+ layoutstyles.overlay_searchTextbox_View,
136
+ ]}
137
+ >
138
+ <Image style={[ComponentStyles.searchIcon]}
139
+ source={{ uri: 'https://i.ibb.co/j8ywYpJ/search.png' }}
140
+ />
141
+ <View style={layoutstyles.textinput_view}>
142
+ <TextInput
143
+ style={[ComponentStyles.searchTextbox]}
144
+ editable={true}
145
+ autoCapitalize={'characters'}
146
+ value={searchData}
147
+ onChangeText={text => setSearchData(text)}
148
+ secureTextEntry={false}
149
+ keyboardType={'default'}
150
+ placeholder="Search"
151
+ />
152
+ </View>
153
+
154
+ </View>
155
+ </View>
156
+
157
+ <View style={getOverlayScreenChildcontainer()}>
158
+ {GetDropdown(alphaFilter ? filterPurpose : displayData)}
159
+ </View>
160
+
161
+ {props.multiselect != undefined && props.multiselect
162
+ && displayData != undefined && displayData.length > 2 ?
163
+ <TouchableOpacity style={{ justifyContent: 'center', borderRadius: 10, alignItems: 'flex-start', paddingHorizontal: normalize(10) }}
164
+ onPress={() => getMultiSelect()}
165
+ >
166
+ <View style={{
167
+ flexDirection: 'column',
168
+ backgroundColor: '#f7f4f4', borderRadius: 10,
169
+ paddingHorizontal: normalize(15),
170
+ paddingVertical: normalize(5),
171
+ alignItems: 'center',
172
+ }}>
173
+ <AntDesign name="select1"
174
+ color={Global.AppTheme.primary_color} size={normalize(20)} />
175
+
176
+ <Text
177
+ style={{
178
+ fontSize: normalize(11),
179
+ color: '#094485',
180
+ fontWeight: 'bold',
181
+ }}>
182
+ {' '}
183
+ Select
184
+ </Text>
185
+ </View>
186
+ </TouchableOpacity> : null}
187
+ {/* Generate button */}
188
+ <TouchableOpacity style={{ justifyContent: 'center', borderRadius: 10, alignItems: 'flex-start', paddingHorizontal: normalize(10) }}
189
+ onPress={() => getFooterFunctions()}
190
+ >
191
+ <View style={{
192
+ flexDirection: 'column',
193
+ backgroundColor: '#f7f4f4', borderRadius: 10,
194
+ paddingHorizontal: normalize(15),
195
+ paddingVertical: normalize(5),
196
+ alignItems: 'center',
197
+ }}>
198
+ <AntDesign name="addfile"
199
+ color={Global.AppTheme.primary_color} size={normalize(20)} />
200
+
201
+ <Text
202
+ style={{
203
+ fontSize: normalize(11),
204
+ color: '#094485',
205
+ fontWeight: 'bold',
206
+ }}>
207
+ {' '}
208
+ Generate
209
+ </Text>
210
+ </View>
211
+ </TouchableOpacity>
212
+ </View>
213
+ );
214
+ }
215
+
216
+ function getMultiSelect(params) {
217
+ var filterArray = displayData.filter((element) => element.selected == true);
218
+ var display = filterArray != undefined &&
219
+ filterArray.length > 0 ? filterArray.map((item) => item.displayvalue) : null;
220
+
221
+ setDropDownData(display.join());
222
+ props.onChangeData(filterArray);
223
+ setDropdownShow(false);
224
+ }
225
+
226
+ function getOverlayChildrenWrapperStyle() {
227
+ return ({
228
+ position: 'absolute',
229
+ bottom: 0,
230
+ // top: Dimensions.get('screen').height * 0.055,
231
+ top: Dimensions.get('screen').height * (PropStyles.overlayheight),
232
+ width: Dimensions.get('window').width,
233
+ // height:Dimensions.get('window').height * 0.8,
234
+ borderRadius: PropStyles.overlayborderRadius,
235
+ borderWidth: 2,
236
+ borderColor: Global.AppTheme.primary_color,
237
+ paddingHorizontal: normalize(5),
238
+ });
239
+ }
240
+
241
+ function getAlphabetData(alpha, index) {
242
+ var filter = displayData.filter(value => (value.displayvalue != undefined ? value.displayvalue : '').charAt(0) == alpha);
243
+ setFilterPurpose(filter);
244
+ index == 0 ? setSearchData('') : setSearchData(alpha);
245
+ index == 0 ? setAlphaFilter(false) : setAlphaFilter(true);
246
+ }
247
+
248
+ return (
249
+ <TouchableOpacity
250
+ onPress={() => props.editable ? FetchDropdownList() : FetchList()}
251
+ style={
252
+ props.buttonstyle ? props.buttonstyle
253
+ :
254
+ {
255
+ borderWidth: 1,
256
+ borderColor: 'lightgrey',
257
+ paddingLeft: 2,
258
+ width: props.widthArr,
259
+ alignItems: 'center',
260
+ paddingRight: 15,
261
+ backgroundColor: props.cornerKey % 2 ? '#fff' : 'white',
262
+ height: props.heightArr ? props.heightArr : Dimensions.get('screen').height * 0.040,
263
+ flexDirection: 'row',
264
+ borderRadius: props.borderRadiusArr ? props.borderRadiusArr : 5,
265
+ borderColor: props.borderArr ? props.borderArr : 'lightgrey',
266
+ elevation: 3,
267
+ }
268
+ }
269
+ >
270
+
271
+ {props.icon ?
272
+ <HOCIcons.Icons
273
+ icongroup={isNU(props.icon.icongroup) ? props.icon.icongroup : 5}
274
+ name={props.icon.name}
275
+ size={props.icon.size}
276
+ style={props.iconstyle}
277
+ />
278
+ : null}
279
+
280
+ {!props.icon && props.iconName ?
281
+ <View style={{ width: normalize(22), paddingLeft: normalize(5) }}>
282
+ <HOCIcons.Icons
283
+ icongroup={5}
284
+ name={props.iconName}
285
+ color={Global.AppTheme.primary_color}
286
+ size={normalize(15)}
287
+ />
288
+ </View>
289
+ : null}
290
+
291
+ {props.cornerKey != null && props.cornerKey != undefined && typeof props.cornerKey === 'string' ?
292
+ <View style={{ position: 'absolute', bottom: 0, right: 3 }}>
293
+ <Text style={{ fontSize: normalize(9), alignSelf: 'flex-start', fontWeight: 'bold' }} >
294
+ {props.cornerKey != null && props.cornerKey != undefined && typeof props.cornerKey === 'string' ? props.cornerKey : ''}</Text>
295
+ </View>
296
+ : null}
297
+
298
+ {isNU(props.textstyle) ?
299
+ <Text adjustsFontSizeToFit style={props.textstyle}>
300
+ {isNU(dropdowndata) ? dropdowndata : null}
301
+ </Text>
302
+ : null}
303
+
304
+ {!isNU(props.textstyle) ?
305
+ <View>
306
+ <Text style={{ fontSize: props.fontSize ? props.fontSize : normalize(12), alignSelf: 'flex-start', fontWeight: props.fontWeight ? props.fontWeight : 'bold' }} >
307
+ {dropdowndata != null && dropdowndata != undefined ? dropdowndata : ''}
308
+ {/* {getDropDownData(dropdowndata)} */}
309
+ </Text>
310
+ </View>
311
+ : null}
312
+
313
+
314
+ {isdropdownshow ?
315
+ <CModalOverlay visible={true}
316
+ onClose={() => setDropdownShow(false)}
317
+ closeOnTouchOutside
318
+ animationType="zoomIn"
319
+ containerStyle={{ backgroundColor: 'transparent' }}
320
+ childrenWrapperStyle={getOverlayChildrenWrapperStyle()}
321
+ animationDuration={500}
322
+ >
323
+ <TouchableOpacity style={{ position: 'absolute', right: 0, zIndex: 1, marginTop: normalize(5) }}
324
+ onPress={() => setDropdownShow(false)}
325
+ >
326
+ <FontAwesome5
327
+ name={'angle-double-down'}
328
+ color={Global.AppTheme.primary_color}
329
+ size={normalize(20)}
330
+ style={{
331
+ marginRight: normalize(7),
332
+ }}
333
+ />
334
+ </TouchableOpacity>
335
+
336
+ {!isLoading ?
337
+ searchResult.httpstatus == 200 ?
338
+ DropdownLayout()
339
+ :
340
+ <View>
341
+ <Text style={[ComponentStyles.no_data_found_text]}>No Result Found</Text>
342
+ </View>
343
+ :
344
+ <View style={{
345
+ flex: 1, width: '100%', justifyContent: 'center',
346
+ backgroundColor: 'transparent', borderRadius: 10,
347
+ }}>
348
+ <SearchLoader />
349
+ </View>}
350
+ </CModalOverlay>
351
+ : null}
352
+
353
+ {stage ?
354
+ <OverlayHOCComponent
355
+ visibility={val => (val == undefined ? null : setStage(val))}
356
+ xyz={val => (val == undefined ? null : setDropDownData(val.displayvalue, setStage(false)))}
357
+ value={props.cornerKey}
358
+ // onselect={val => (val == undefined ? null : onSelect(val))}
359
+ // data={searchResult != null && searchResult != undefined && searchResult.length > 0 ? searchResult : null}
360
+ /> : null}
361
+ </TouchableOpacity>
362
+
363
+ );
364
+
365
+ function GetDropdown(data) {
366
+
367
+ const newDropDownData = data.filter(function (item) {
368
+ const dataItem = item.displayvalue ? item.displayvalue.toUpperCase() : ''.toUpperCase();
369
+ const textData = searchData.toUpperCase();
370
+ return dataItem.indexOf(textData) > -1;
371
+ });
372
+
373
+ return (
374
+ <View style={{ flexDirection: 'row' }}>
375
+ <FlatList
376
+ data={newDropDownData}
377
+ renderItem={renderItem}
378
+ initialNumToRender={10}
379
+ maxToRenderPerBatch={20}
380
+ keyExtractor={(item, index) => 'key' + index}
381
+ />
382
+
383
+ <SAlphabet
384
+ callBack={val =>
385
+ val == undefined ? null : getAlphabetData(val.alpha, val.index)
386
+ } />
387
+ </View>
388
+ );
389
+ }
390
+
391
+ function multiselect(item, keycode) {
392
+ item.selected = !item.selected;
393
+ setRefresh(refresh + 1);
394
+ }
395
+
396
+ function renderItem(data) {
397
+
398
+ return (
399
+ <TouchableOpacity
400
+ style={[getListviewItem(data.item.selected), { flexDirection: 'row', alignItems: 'center' }]}
401
+ onPress={() => props.multiselect != undefined ? multiselect(data.item, props.keycode) : selection(data.item, data.item.selected, props.keycode)}
402
+ activeOpacity={0.5}
403
+ >
404
+ <Icons.FontAwesome name="dot-circle-o" color={Global.AppTheme.primary_color} size={normalize(12)}
405
+ style={{ paddingHorizontal: normalize(2), paddingLeft: normalize(4) }} />
406
+ <Text style={selectedValue != null && selectedValue != undefined ? selectedValue == item.datavalue ? getListviewItemText(true) : getListviewItemText(false) : getListviewItemText(false)}>
407
+ {data.item.displayvalue}
408
+ </Text>
409
+ </TouchableOpacity>
410
+ );
411
+ }
412
+
413
+ function getOverlayScreenChildcontainer() {
414
+ return (
415
+ {
416
+ flex: 1,
417
+ marginBottom: Dimensions.get('window').height * 0.01,
418
+ marginTop: Dimensions.get('window').height * 0.01,
419
+ }
420
+ );
421
+ }
422
+ };
423
+
424
+ const layoutstyles = StyleSheet.create({
425
+ lefticon_container: {
426
+ marginLeft: '2%',
427
+ },
428
+ textinput_view: {
429
+ flex: 1,
430
+ paddingLeft: '1%',
431
+ },
432
+ overlay_screen_listview_container: {
433
+ justifyContent: 'center',
434
+ marginBottom: 10,
435
+ },
436
+ overlay_searchTextbox_View: {
437
+ width: '96%',
438
+
439
+ },
440
+ overlay_screen_heading_text: {
441
+ ...ComponentStyles.popup_heading,
442
+ width: '100%',
443
+ },
444
+ overlay_screen_container: {
445
+ width: '100%',
446
+ flex: 1,
447
+ },
448
+ });
449
+
450
+ export default SDropDownGenerate;