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

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 +26 -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,500 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import {
3
+ TouchableOpacity,
4
+ StyleSheet,
5
+ View,
6
+ TouchableHighlight,
7
+ Text,
8
+ Image,
9
+ TextInput,
10
+ ScrollView,
11
+ FlatList,
12
+ Platform,
13
+ } from 'react-native';
14
+ import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
15
+ import ComponentStyles, { normalize } from '../CommonStyle/componentStyle';
16
+ import popupStyles, {
17
+ getListviewItem,
18
+ getListviewItemText,
19
+ } from '../CommonStyle/PopupStyle';
20
+ import { APIURL } from '../Common/apiConstants';
21
+ import { Dimensions } from 'react-native';
22
+ import SearchLoader from '../Custom/SearchLoader';
23
+ import AntDesign from 'react-native-vector-icons/AntDesign';
24
+ import SAlphabet from './SAlphabet';
25
+ import Icons, { MaterialCommunityIcons } from '../Common/Icons';
26
+ import { isBNU } from '../CommonStyle/ComponentFunctions';
27
+ import CModalOverlay from '../CustomComponents/CModalOverlay';
28
+
29
+ var searchResult = [];
30
+ var tempvalue = [];
31
+ var ValueString = null;
32
+ const SDropDownIcon = props => {
33
+ // console.log('ooooooooooooooooooooooooooooverlaaaaaaaaaaaaaaaaaaaaaaay', props.overlay)
34
+
35
+ useEffect(() => {
36
+ isBNU(props.overlay) && props.overlay == true ? FetchDropdownList() : null;
37
+ }, [props.overlay]);
38
+
39
+ const [isdropdownshow, setDropdownShow] = useState(false);
40
+ const [searchData, setSearchData] = useState('');
41
+ const [isLoading, setIsLoading] = useState(true);
42
+ const [selectedValue, setSelectedValue] = useState(props.value);
43
+ const [displayData, setDisplayData] = useState([]);
44
+ const [stage, setStage] = useState(false);
45
+ const [refresh, setRefresh] = useState(0);
46
+ const [filterPurpose, setFilterPurpose] = useState([]);
47
+ const [alphaFilter, setAlphaFilter] = useState(false);
48
+ const [dropdowndata, setDropDownData] = useState(props.dropdowndata);
49
+ // console.log("...............................>>>>>>>>>>>>",displayData)
50
+ function getOverlayScreenContainer() {
51
+ return {
52
+ flexDirection: 'row',
53
+ margin: 10,
54
+ };
55
+ }
56
+
57
+ useEffect(() => {
58
+ setAlphaFilter(false);
59
+ });
60
+
61
+ function FetchDropdownList(key) {
62
+ const updatedApiUrl = props.dropdownPort ? APIURL : APIURL;
63
+ setSearchData('');
64
+ setIsLoading(true);
65
+ setDropdownShow(true);
66
+ // console.log("JJJJJJJMMMMMMMMMHHHHHHHHHHHHHHHHH", APIURL + props.dropdownapi)
67
+ NetworkServiceCall('get', updatedApiUrl + props.dropdownapi, '').then(
68
+ function (response) {
69
+ // console.log('dataaaaaaaaaaaa###############', JSON.stringify(response.data.data))
70
+ console.log(
71
+ 'updated url #############################',
72
+ updatedApiUrl + props.dropdownapi,
73
+ );
74
+ if (response.data.data != null && response.data.data != undefined) {
75
+ searchResult = response;
76
+ setDisplayData(response.data.data);
77
+ setIsLoading(false);
78
+ } else {
79
+ searchResult = [];
80
+ setDisplayData([]);
81
+ setIsLoading(false);
82
+ }
83
+ },
84
+ );
85
+ }
86
+
87
+ function FetchList() {
88
+ setSearchData('');
89
+ setIsLoading(true);
90
+ setDropdownShow(true);
91
+ searchResult = { httpstatus: 200 };
92
+ setDisplayData(props.dropdownarray);
93
+ setIsLoading(false);
94
+ }
95
+
96
+ function selection(item, changevalue, keycode) {
97
+ let dataset = {
98
+ datavalue: item.datavalue,
99
+ displayvalue: item.displayvalue,
100
+ key: keycode,
101
+ };
102
+ setDropDownData(item.displayvalue);
103
+ props.stewardship != undefined && props.stewardship
104
+ ? props.onChangeData(item)
105
+ : props.onChangeData(dataset);
106
+ props.refreshCount(1);
107
+ // props.editStatus(1)
108
+ setDropdownShow(false);
109
+ if (props.setOverlay) {
110
+ props.setOverlay(false);
111
+ }
112
+ }
113
+
114
+ function DropdownLayout() {
115
+ return (
116
+ <View style={layoutstyles.overlay_screen_container}>
117
+ <View style={{ alignItems: 'center' }}>
118
+ <Text
119
+ style={{
120
+ fontSize: normalize(12),
121
+ fontWeight: 'bold',
122
+ color: 'darkblue',
123
+ }}>
124
+ {' '}
125
+ {props.headerName ? props.headerName : 'SELECT OPTION'}{' '}
126
+ </Text>
127
+ </View>
128
+
129
+ <View style={getOverlayScreenContainer()}>
130
+ <View
131
+ style={[
132
+ ComponentStyles.searchTextbox_View,
133
+ layoutstyles.overlay_searchTextbox_View,
134
+ ]}>
135
+ <View style={layoutstyles.textinput_view}>
136
+ <TextInput
137
+ style={[ComponentStyles.searchTextbox]}
138
+ editable={true}
139
+ autoCapitalize={'characters'}
140
+ value={searchData}
141
+ onChangeText={text => setSearchData(text)}
142
+ secureTextEntry={false}
143
+ keyboardType={'default'}
144
+ placeholder="Search"
145
+ placeholderTextColor="black"
146
+ />
147
+ </View>
148
+ <Image
149
+ style={[ComponentStyles.searchIcon]}
150
+ source={{ uri: 'https://i.ibb.co/j8ywYpJ/search.png' }}
151
+ />
152
+ </View>
153
+ </View>
154
+
155
+ <View style={getOverlayScreenChildcontainer()}>
156
+ {GetDropdown(alphaFilter ? filterPurpose : displayData)}
157
+ </View>
158
+
159
+ </View>
160
+ );
161
+ }
162
+
163
+ function getMultiSelect(params) {
164
+ // Safely filter selected items
165
+ const filterArray = Array.isArray(displayData)
166
+ ? displayData.filter(element => element?.selected === true)
167
+ : [];
168
+
169
+ // Extract display values if any selected items exist
170
+ const display =
171
+ filterArray.length > 0
172
+ ? filterArray.map(item => item?.displayvalue).join(', ')
173
+ : '';
174
+
175
+ // Update dropdown data text
176
+ setDropDownData(display);
177
+
178
+ // Notify parent component of selected items
179
+ if (typeof props?.onChangeData === 'function') {
180
+ props.onChangeData(filterArray);
181
+ }
182
+
183
+ // Hide dropdown UI
184
+ setDropdownShow(false);
185
+
186
+ // Hide overlay if provided
187
+ if (typeof props?.setOverlay === 'function') {
188
+ props.setOverlay(false);
189
+ }
190
+ }
191
+
192
+ function getOverlayChildrenWrapperStyle() {
193
+ return {
194
+ position: 'absolute',
195
+ bottom: 0,
196
+ top: Dimensions.get('screen').height * 0.17,
197
+ width: Dimensions.get('screen').width,
198
+ borderRadius: 20,
199
+ borderWidth: 2,
200
+ borderColor: '#e0e0e0',
201
+ paddingHorizontal: normalize(5),
202
+ };
203
+ }
204
+
205
+ function getAlphabetData(alpha, index) {
206
+ var filter = displayData.filter(
207
+ value =>
208
+ (value.displayvalue != undefined ? value.displayvalue : '').charAt(0) ==
209
+ alpha,
210
+ );
211
+ setFilterPurpose(filter);
212
+ index == 0 ? setSearchData('') : setSearchData(alpha);
213
+ index == 0 ? setAlphaFilter(false) : setAlphaFilter(true);
214
+ }
215
+
216
+ return (
217
+ <View style={{ elevation: 3 }}>
218
+ <TouchableOpacity
219
+ onPress={() => (props.editable ? FetchDropdownList() : FetchList())}
220
+ // onLongPress={() => props.LongPress ? setStage(true) : null}
221
+ // style={{
222
+ // borderWidth: 1,borderColor:'lightgrey'
223
+ // , paddingLeft: 2, width: props.widthArr, alignItems: 'center', paddingRight: 15,
224
+ // backgroundColor:props.backgroundColor != undefined ? props.backgroundColor : "#fff",
225
+ // height: props.heightArr ? props.heightArr : Dimensions.get('screen').height * 0.040,
226
+ // flexDirection: 'row', borderRadius:props.borderRadiusArr ? props.borderRadiusArr :5,
227
+ // borderColor: props.borderArr ? props.borderArr : 'lightgrey',
228
+ // }}
229
+ >
230
+ {props.iconName ? (
231
+ <View
232
+ style={{
233
+ width: normalize(40),
234
+ borderWidth: 0,
235
+ alignItems: 'center',
236
+ }}>
237
+ <FontAwesome5
238
+ name={props.iconName}
239
+ color={props.flagData == 1 ? 'darkblue' : '#094485'}
240
+ size={props.size ? props.size : normalize(24)}
241
+ />
242
+ </View>
243
+ ) : (
244
+ <View style={{ width: normalize(40), marginHorizontal: normalize(0) }}>
245
+ <MaterialCommunityIcons
246
+ name={props.icon}
247
+ color={props.flagData == 1 ? 'darkblue' : '#094485'}
248
+ size={props.size ? props.size : normalize(24)}
249
+ />
250
+ </View>
251
+ )}
252
+
253
+ {/* <View style={{ position: 'absolute', bottom: 0, right: 3, }}>
254
+ <Text style={{ fontSize: normalize(11), alignSelf: 'flex-start', fontWeight: 'bold' }} >
255
+ {props.cornerKey != null && props.cornerKey != undefined && typeof props.cornerKey === 'string' ? props.cornerKey : ""}</Text>
256
+ </View> */}
257
+ {/* <View>
258
+ <Text adjustsFontSizeToFit numberOfLines={2} style={{ fontSize: normalize(12), alignSelf: 'flex-start', fontWeight: 'bold' ,marginHorizontal:normalize(7)}} >
259
+ {dropdowndata != null && dropdowndata != undefined ? dropdowndata : ""}
260
+ </Text>
261
+ </View> */}
262
+ {isdropdownshow ? (
263
+ <CModalOverlay
264
+ visible={true}
265
+ onClose={() => {
266
+ setDropdownShow(false);
267
+ if (props.setOverlay) {
268
+ props.setOverlay(false);
269
+ }
270
+ }}
271
+ closeOnTouchOutside
272
+ animationType="zoomIn"
273
+ containerStyle={{ backgroundColor: 'transparent' }}
274
+ childrenWrapperStyle={getOverlayChildrenWrapperStyle()}
275
+ animationDuration={500}
276
+ footer={
277
+ props.multiselect != undefined &&
278
+ props.multiselect &&
279
+ displayData != undefined &&
280
+ displayData.length > 0 ? (
281
+ <TouchableOpacity
282
+ style={{
283
+ justifyContent: 'center',
284
+ borderRadius: 10,
285
+ alignItems: 'center',
286
+ paddingHorizontal: normalize(10),
287
+ }}
288
+ onPress={() => getMultiSelect()}>
289
+ <View
290
+ style={{
291
+ flexDirection: 'column',
292
+ backgroundColor: '#f7f4f4',
293
+ borderRadius: 10,
294
+ paddingHorizontal: normalize(15),
295
+ paddingVertical: normalize(5),
296
+ alignItems: 'center',
297
+ }}>
298
+ <AntDesign
299
+ name="select1"
300
+ color={'#094485'}
301
+ size={normalize(20)}
302
+ />
303
+
304
+ <Text
305
+ style={{
306
+ fontSize: normalize(11),
307
+ color: '#094485',
308
+ fontWeight: 'bold',
309
+ }}>
310
+ {' '}
311
+ Select
312
+ </Text>
313
+ </View>
314
+ </TouchableOpacity>
315
+ ) : null
316
+ }
317
+
318
+ >
319
+ <TouchableOpacity
320
+ style={{
321
+ position: 'absolute',
322
+ right: 0,
323
+ zIndex: 1,
324
+ marginTop: normalize(5),
325
+ }}
326
+ onPress={() => {
327
+ setDropdownShow(false);
328
+ if (props.setOverlay) {
329
+ props.setOverlay(false);
330
+ }
331
+ }}>
332
+ <FontAwesome5
333
+ name={'angle-double-down'}
334
+ color={'#094485'}
335
+ size={normalize(20)}
336
+ />
337
+ </TouchableOpacity>
338
+
339
+ {!isLoading ? (
340
+ searchResult.httpstatus == 200 ? (
341
+ DropdownLayout()
342
+ ) : (
343
+ <View>
344
+ <Text style={[ComponentStyles.no_data_found_text]}>
345
+ No Result Found
346
+ </Text>
347
+ </View>
348
+ )
349
+ ) : (
350
+ <View
351
+ style={{
352
+ flex: 1,
353
+ width: '100%',
354
+ justifyContent: 'center',
355
+ backgroundColor: 'transparent',
356
+ borderRadius: 10,
357
+ }}>
358
+ <SearchLoader />
359
+ </View>
360
+ )}
361
+ </CModalOverlay>
362
+ ) : null}
363
+
364
+ {stage ? (
365
+ <OverlayHOCComponent
366
+ visibility={val => (val == undefined ? null : setStage(val))}
367
+ xyz={val =>
368
+ val == undefined
369
+ ? null
370
+ : setDropDownData(val.displayvalue, setStage(false))
371
+ }
372
+ value={props.cornerKey}
373
+ // onselect={val => (val == undefined ? null : onSelect(val))}
374
+ // data={searchResult != null && searchResult != undefined && searchResult.length > 0 ? searchResult : null}
375
+ />
376
+ ) : null}
377
+ </TouchableOpacity>
378
+ </View>
379
+ );
380
+
381
+ function GetDropdown(data) {
382
+ const newDropDownData = data.filter(function (item) {
383
+ const dataItem = item.displayvalue
384
+ ? item.displayvalue.toUpperCase()
385
+ : ''.toUpperCase();
386
+ const textData = searchData.toUpperCase();
387
+ return dataItem.indexOf(textData) > -1;
388
+ });
389
+ return (
390
+ <View style={{ flexDirection: 'row', flex: 1, width: '100%' }}>
391
+ <FlatList
392
+ style={{ flex: 1 }}
393
+ data={newDropDownData}
394
+ renderItem={renderItem}
395
+ initialNumToRender={Math.max(50, newDropDownData.length)}
396
+ maxToRenderPerBatch={newDropDownData.length + 10}
397
+ windowSize={21}
398
+ removeClippedSubviews={false}
399
+ nestedScrollEnabled={true}
400
+ keyExtractor={(item, index) => 'key' + index}
401
+ />
402
+
403
+ <SAlphabet
404
+ callBack={val =>
405
+ val == undefined ? null : getAlphabetData(val.alpha, val.index)
406
+ }
407
+ />
408
+
409
+ {/* <View style={{
410
+ height: Dimensions.get('window').height * 0.37,
411
+ marginBottom: Dimensions.get('window').height * 0.01,
412
+ }}>
413
+ <FlatList
414
+ data={["#", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"]}
415
+ renderItem={renderAlphabet}
416
+ style={{ paddingBottom: 20 }}
417
+ contentContainerStyle={{ alignItems: 'center' }}
418
+ keyExtractor={(item, index) => 'key' + index}
419
+ />
420
+ </View> */}
421
+ </View>
422
+ );
423
+ }
424
+
425
+ function multiselect(item, keycode) {
426
+ item.selected = !item.selected;
427
+ setRefresh(refresh + 1);
428
+ }
429
+
430
+ function renderItem(data) {
431
+ // console.log("-----------------------------",data)
432
+ return (
433
+ <TouchableOpacity
434
+ style={[
435
+ getListviewItem(data.item.selected),
436
+ { flexDirection: 'row', alignItems: 'center' },
437
+ ]}
438
+ onPress={() =>
439
+ props.multiselect != undefined
440
+ ? multiselect(data.item, props.keycode)
441
+ : selection(data.item, data.item.selected, props.keycode)
442
+ }
443
+ activeOpacity={0.5}>
444
+ <Icons.FontAwesome
445
+ name="dot-circle-o"
446
+ color="darkblue"
447
+ size={normalize(12)}
448
+ style={{ paddingHorizontal: normalize(2), paddingLeft: normalize(4) }}
449
+ />
450
+ <Text
451
+ style={
452
+ selectedValue != null && selectedValue != undefined
453
+ ? selectedValue == data.item.datavalue
454
+ ? getListviewItemText(true)
455
+ : getListviewItemText(false)
456
+ : getListviewItemText(false)
457
+ }>
458
+ {data.item.displayvalue}
459
+ </Text>
460
+ </TouchableOpacity>
461
+ );
462
+ }
463
+
464
+ function getOverlayScreenChildcontainer() {
465
+ return {
466
+ flex: 1,
467
+ marginBottom: Dimensions.get('window').height * 0.01,
468
+ marginTop: Dimensions.get('window').height * 0.01,
469
+ maxHeight: Platform.OS === 'web' && Dimensions.get('window').height * 0.4,
470
+
471
+ };
472
+ }
473
+ };
474
+
475
+ const layoutstyles = StyleSheet.create({
476
+ lefticon_container: {
477
+ marginLeft: '2%',
478
+ },
479
+ textinput_view: {
480
+ flex: 1,
481
+ paddingLeft: '1%',
482
+ },
483
+ overlay_screen_listview_container: {
484
+ justifyContent: 'center',
485
+ marginBottom: 10,
486
+ },
487
+ overlay_searchTextbox_View: {
488
+ width: '96%',
489
+ },
490
+ overlay_screen_heading_text: {
491
+ ...ComponentStyles.popup_heading,
492
+ width: '100%',
493
+ },
494
+ overlay_screen_container: {
495
+ width: '100%',
496
+ flex: 1,
497
+ },
498
+ });
499
+
500
+ export default SDropDownIcon;
@@ -0,0 +1,131 @@
1
+ import React, { useState } from 'react';
2
+ import { View, Text, FlatList, ActivityIndicator } from 'react-native';
3
+ import { normalize } from '../CommonStyle/componentStyle';
4
+ import {
5
+ Menu,
6
+ MenuOptions,
7
+ MenuOption,
8
+ MenuTrigger,
9
+ } from 'react-native-popup-menu';
10
+ import { APIURL } from '../Common/apiConstants';
11
+ import Icons from '../Common/Icons';
12
+ import NetworkServiceCall from '../Common/NetworkServiceCall';
13
+ import { Global } from '../Common/Global';
14
+ import { getLoading, isBNU, isBNUL, isNU, ValueCheck } from '../CommonStyle/ComponentFunctions';
15
+
16
+ const SMenuBox = (props) => {
17
+ const [isLoading, setIsLoading] = useState(false);
18
+ const [displayData, setDisplayData] = useState([]);
19
+ const [dropdowndata, setDropDownData] = useState(props.dropdowndata);
20
+ // console.log("kkkkkkkkkkkkkkkkkkkkk",JSON.stringify(props.editable))
21
+ function FetchDropdownList(key) {
22
+ setIsLoading(true);
23
+ let buttonapi = APIURL + props.dropdownapi;
24
+ console.log('SDROPDOWNLINK___________________', 'get', buttonapi);
25
+ NetworkServiceCall('get', buttonapi, '')
26
+ .then(function (response) {
27
+ if (response.data.data != null && response.data.data != undefined) {
28
+ setDisplayData(response.data.data);
29
+ setIsLoading(false);
30
+ }
31
+ else {
32
+ setDisplayData([]);
33
+ setIsLoading(false);
34
+ }
35
+ });
36
+ getLoading(v => setIsLoading(false));
37
+ }
38
+
39
+ function FetchList() {
40
+ setIsLoading(true);
41
+ setDisplayData(props.dropdownarray);
42
+ setIsLoading(false);
43
+ }
44
+
45
+ function selection(item, keycode) {
46
+ let dataset = {
47
+ 'datavalue': item.datavalue,
48
+ 'displayvalue': item.displayvalue,
49
+ 'detailcode': item.detailcode,
50
+ 'color': item.color,
51
+ 'key': keycode,
52
+ 'item': item,
53
+ };
54
+ if (ValueCheck(props.displaytext) && props.displaytext) {
55
+ setDropDownData(item.displayvalue);
56
+ }
57
+ props.onChangeData(dataset);
58
+ }
59
+
60
+ return (
61
+ <Menu>
62
+ <MenuTrigger
63
+ onPress={() => props.editable ? FetchDropdownList() : FetchList()}
64
+ >
65
+ <View style={{ flexDirection: 'row', alignItems: 'center' }}>
66
+
67
+ {ValueCheck(props.displaytext) && props.displaytext ? null : <Text adjustsFontSizeToFit style={{ fontSize: normalize(13), fontWeight: ValueCheck(dropdowndata) ? '600' : '400', marginRight: normalize(5), color: ValueCheck(dropdowndata) ? 'black' : 'grey' }}>{ValueCheck(dropdowndata) ? dropdowndata : props.display}</Text>}
68
+ <View>
69
+ {!isLoading ?
70
+ <Icons.MaterialCommunityIcons
71
+ name={ValueCheck(props.iconName) ? props.iconName : 'chevron-double-down'}
72
+ color={Global.AppTheme.primary_color}
73
+ size={normalize(30)}
74
+ /> :
75
+ <ActivityIndicator size={normalize(22)} color="red" />}
76
+ </View>
77
+ </View>
78
+ </MenuTrigger>
79
+
80
+ <MenuOptions
81
+ customStyles={{
82
+ optionsContainer: {},
83
+ optionWrapper: { marginRight: normalize(5) },
84
+ optionText: {},
85
+ }}>
86
+ {isBNUL(displayData) ?
87
+ <View>
88
+ <FlatList
89
+ data={displayData}
90
+ renderItem={renderItem}
91
+ initialNumToRender={10}
92
+ maxToRenderPerBatch={20}
93
+ keyExtractor={(item, index) => 'key' + index}
94
+ />
95
+ </View> : null}
96
+ </MenuOptions>
97
+ </Menu>
98
+
99
+ );
100
+
101
+ function renderItem({ item }) {
102
+ return (
103
+ <MenuOption
104
+ onSelect={() => selection(item, props.keycode)}
105
+ style={{ flexDirection: 'row', alignItems: 'center' }}>
106
+
107
+ <View style={{ width: normalize(20), alignItems: 'center' }}>
108
+ <Icons.FontAwesome5
109
+ name={ValueCheck(item.iconname) ? item.iconname : 'dot-circle'}
110
+ color={Global.AppTheme.primary_color}
111
+ size={normalize(18)}
112
+ />
113
+ </View>
114
+
115
+ <Text adjustsFontSizeToFit
116
+ numberOfLines={1}
117
+ style={{
118
+ fontSize: normalize(12),
119
+ fontWeight: 'bold',
120
+ marginLeft: '10%',
121
+ color: 'darkblue',
122
+ }}>
123
+ {item.displayvalue}
124
+ </Text>
125
+ </MenuOption>
126
+ );
127
+ }
128
+
129
+ };
130
+
131
+ export default SMenuBox;