@jescon-technologies/react-native-ui-kit 0.0.4 → 0.0.6
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.
- package/index.d.ts +66 -0
- package/index.js +3 -7
- package/package.json +3 -2
- package/src/Alerts/AAlert.js +4 -4
- package/src/Alerts/AAlertIOS.js +3 -3
- package/src/{common → Common}/NetworkServiceCall.js +1 -1
- package/src/CommonStyle/CommonTheme.js +11 -0
- package/src/CommonStyle/ComponentFunctions.js +632 -0
- package/src/CommonStyle/PopupStyle.js +146 -0
- package/src/CommonStyle/commonStyle.js +93 -0
- package/src/CommonStyle/componentStyle.js +545 -0
- package/src/CommonStyle/optionListStyles.js +175 -0
- package/src/Components/ByProductPage.js +200 -0
- package/src/Components/CDropDownListNew.js +153 -0
- package/src/Components/CSupplierList.js +88 -0
- package/src/Components/CVerificationCard.js +2822 -0
- package/src/Components/CustomButton.js +67 -0
- package/src/Components/CustomCard.js +127 -0
- package/src/Components/CustomTextInput.js +47 -0
- package/src/Components/EquipmentPage.js +313 -0
- package/src/Components/FilterInput.Copy.js +723 -0
- package/src/Components/FilterInput.js +569 -0
- package/src/Components/HSubHeading.js +68 -0
- package/src/Components/HeaderCard.js +40 -0
- package/src/Components/MoreOptionsScreen.js +251 -0
- package/src/Components/NonSwipableProductCard.js +226 -0
- package/src/Components/NonSwipableSupplierCard.js +348 -0
- package/src/Components/ProductCard.js +1336 -0
- package/src/Components/QualityProductCard.js +1059 -0
- package/src/Components/RateProductCard.js +1452 -0
- package/src/Components/RawMaterial.js +261 -0
- package/src/Components/SDropDownEdited.js +549 -0
- package/src/Components/SDropDownNew.js +529 -0
- package/src/Components/SHelpDescription.js +147 -0
- package/src/Components/STextInputNew.js +510 -0
- package/src/Components/SearchProductCard.js +470 -0
- package/src/Components/StageByProduct.js +199 -0
- package/src/Components/SupplierCard.js +243 -0
- package/src/Components/SupplierInvoiceCard.js +405 -0
- package/src/Components/SwipableSupplierCard.js +136 -0
- package/src/Components/TagTemplate.js +74 -0
- package/src/Components/WrappedComponent.js +25 -0
- package/src/Custom/CBooking.js +944 -0
- package/src/Custom/CBookingPostpone.js +1822 -0
- package/src/Custom/CCalendar.js +560 -0
- package/src/Custom/CCard.js +880 -0
- package/src/Custom/CDetailCard.js +205 -0
- package/src/Custom/CHelpImage.js +52 -0
- package/src/Custom/CReport.js +569 -0
- package/src/Custom/CScrollView.js +73 -0
- package/src/Custom/CSignature.js +112 -0
- package/src/Custom/CSliderMenu.js +339 -0
- package/src/Custom/CSupplierCard.js +99 -0
- package/src/Custom/CTemplateCard.js +438 -0
- package/src/Custom/CTokenAllocation.js +1402 -0
- package/src/Custom/CTokenListOverlay.js +122 -0
- package/src/Custom/CWardStatus.js +444 -0
- package/src/Custom/Charts/CBarChart.js +218 -0
- package/src/Custom/Charts/CDashBoardList.js +133 -0
- package/src/Custom/Charts/CDashBoardTable.js +172 -0
- package/src/Custom/Charts/CLineChart.js +193 -0
- package/src/Custom/Charts/CPieChart.js +186 -0
- package/src/Custom/Loader.js +182 -0
- package/src/Custom/OUserView.js +1121 -0
- package/src/Custom/PreviewDosage.js +115 -0
- package/src/Custom/SearchLoader.js +32 -0
- package/src/Custom/TableComponent/CActivityTable.js +707 -0
- package/src/Custom/TableComponent/CMoreButtonTable.js +197 -0
- package/src/Custom/TableComponent/CTable.js +185 -0
- package/src/Custom/TableComponent/CTextBody.js +40 -0
- package/src/Custom/TableComponent/CTextHeader.js +17 -0
- package/src/Custom/TableComponent/PreviewPrescriptionNew.js +1011 -0
- package/src/Custom/TableComponent/SDropdownTable.js +491 -0
- package/src/Custom/TableComponent/TagTable.js +1200 -0
- package/src/CustomComponents/CAddColumn.js +140 -0
- package/src/CustomComponents/CAssessmentDelete.js +307 -0
- package/src/CustomComponents/CAwesomeButton.js +83 -0
- package/src/CustomComponents/CAwesomeMoreButton.js +54 -0
- package/src/CustomComponents/CBackHandler.js +273 -0
- package/src/CustomComponents/CCalendar.js +243 -0
- package/src/CustomComponents/CCommentOverlay.js +202 -0
- package/src/CustomComponents/CComments.js +162 -0
- package/src/CustomComponents/CContainerView.js +24 -0
- package/src/CustomComponents/CCustomTextInput.js +336 -0
- package/src/CustomComponents/CDetailView.js +40 -0
- package/src/CustomComponents/CDropDownList.js +153 -0
- package/src/CustomComponents/CDropdownSelect.js +555 -0
- package/src/CustomComponents/CFooterView.js +42 -0
- package/src/CustomComponents/CImagePickerSave.js +316 -0
- package/src/CustomComponents/CModalOverlay.js +91 -0
- package/src/CustomComponents/CNetworkStatus.js +327 -0
- package/src/CustomComponents/CNotesInstructions.js +1000 -0
- package/src/CustomComponents/COverlay.js +81 -0
- package/src/CustomComponents/CRemarks.js +176 -0
- package/src/CustomComponents/CRowAdd.js +143 -0
- package/src/CustomComponents/CSummaryDropDown.js +327 -0
- package/src/CustomComponents/CText.js +9 -0
- package/src/CustomComponents/CVectorIcon.js +34 -0
- package/src/CustomComponents/HtmlContentViewer.js +65 -0
- package/src/CustomComponents/PdfContentViewer.js +90 -0
- package/src/CustomComponents/SDropDownDosage.js +1087 -0
- package/src/CustomComponents/SwipableProductCard.js +246 -0
- package/src/CustomComponents/SwipableProductImageCard.js +254 -0
- package/src/CustomComponents/WorkOrderDetails.js +1216 -0
- package/src/CustomComponents/WorkOrderDetailsPage.js +1213 -0
- package/src/HOC/ConfirmOverlay.js +2 -2
- package/src/HOC/HMoreButton.js +1 -1
- package/src/HOC/HNatureHeading.js +1 -1
- package/src/HOC/HShadowButton.js +1 -1
- package/src/HOC/HShadowCountButton.js +1 -1
- package/src/Json/Chart.json +818 -0
- package/src/Json/Consultation.json +622 -0
- package/src/Json/CreditBill.json +490 -0
- package/src/Json/Dropdown.json +216 -0
- package/src/Json/DropdownConsultation.json +228 -0
- package/src/Json/DynamicReports.json +623 -0
- package/src/Json/Footer.json +79 -0
- package/src/Media/AudioScreen.js +2 -7
- package/src/Media/CCaptureImageWithoutEdit.js +1 -1
- package/src/Media/CImageGallery.js +2 -2
- package/src/Media/CSingleImage.js +2 -2
- package/src/Media/CVideoPlay.js +1 -1
- package/src/Media/DocumentScreen.js +2 -7
- package/src/Media/DrawingScreen.js +2 -6
- package/src/Media/ImageScreen.js +2 -6
- package/src/Media/RecordAudio.js +1 -1
- package/src/Media/VideoScreen.js +2 -7
- package/src/Navigation/PageNavigation.js +224 -0
- package/src/Navigation/useFocusEffect.js +2 -0
- package/src/Navigation/useFocusEffect.native.js +1 -0
- package/src/Navigation/useFocusEffect.web.js +1 -0
- package/src/Navigation/useIsFocused.js +1 -0
- package/src/Navigation/useIsFocused.native.js +1 -0
- package/src/Navigation/useIsFocused.web.js +1 -0
- package/src/Navigation/useNavigation.js +2 -0
- package/src/Navigation/useNavigation.native.js +1 -0
- package/src/Navigation/useNavigation.web.js +1 -0
- package/src/Screens/CMedications.js +528 -0
- package/src/Screens/CWebViewGallery.js +203 -0
- package/src/Screens/ChartScan.js +279 -0
- package/src/Screens/ChartScreenNew.js +1579 -0
- package/src/Screens/Consultation.js +1500 -0
- package/src/Screens/Dashboard.js +778 -0
- package/src/Screens/FileExplorer.js +288 -0
- package/src/Screens/Footer.js +340 -0
- package/src/Screens/ForgotPassword.js +288 -0
- package/src/Screens/HeaderBlock.js +353 -0
- package/src/Screens/Login.js +328 -0
- package/src/Screens/Notification.js +149 -0
- package/src/Screens/OcrScreen.js +20 -0
- package/src/Screens/PdfPreview.js +507 -0
- package/src/Screens/RegistrationDetails.js +467 -0
- package/src/Screens/SearchScreen.js +582 -0
- package/src/Screens/Splash.js +788 -0
- package/src/Screens/SwipeLeftView.js +1867 -0
- package/src/StaticComponents/SDatePickerLabel.js +1 -1
- package/src/StaticComponents/SDatePickerNew.js +1 -1
- package/src/StaticComponents/SDateTimePickerNew.js +2 -2
- package/src/StaticComponents/SDropDownGenerate.js +3 -3
- package/src/StaticComponents/SDropDownHoc.js +4 -4
- package/src/StaticComponents/SDropDownIcon.js +1 -1
- package/src/StaticComponents/SMenuBox.js +2 -2
- package/src/StaticComponents/SSearch.js +2 -2
- package/src/StaticComponents/STextInput.js +1 -1
- package/src/StaticComponents/STimePicker.js +1 -1
- package/src/StaticComponents/STimingDropDownNew.js +2 -6
- package/src/StaticComponents/STimingSwitch.js +1 -1
- package/src/layout/CContainerView.js +1 -1
- package/src/layout/CDetailView.js +3 -3
- package/src/layout/HeaderBlock.js +5 -5
- package/src/layout/INVLoginLayout.js +3 -4
- package/src/layout/Loader.js +2 -2
- package/src/HOC/HAbsolute.js +0 -56
- package/src/HOC/HDiscontinue.js +0 -105
- package/src/HOC/HOverlay.js +0 -99
- package/src/layout/FooterBlock.js +0 -821
- /package/src/{common → Common}/ErrorBoundary.tsx +0 -0
- /package/src/{common → Common}/Icons.js +0 -0
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import React, { memo, useState, useRef, useEffect, useCallback } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
View,
|
|
4
|
+
TextInput,
|
|
5
|
+
Text,
|
|
6
|
+
Animated,
|
|
7
|
+
TouchableOpacity,
|
|
8
|
+
Keyboard,
|
|
9
|
+
} from 'react-native';
|
|
10
|
+
import HOCIcons from '../HOC/HOCIcons';
|
|
11
|
+
import { isNU, isNUQ, isNUQZ, normalize } from '../CommonStyle/ComponentFunctions';
|
|
12
|
+
import { Global } from '../../../../../src/Common/Global';
|
|
13
|
+
|
|
14
|
+
const CCustomTextInput = (props) => {
|
|
15
|
+
// Initialize text from props or empty string
|
|
16
|
+
const [text, setText] = useState(() => {
|
|
17
|
+
const initialValue = props?.data?.value;
|
|
18
|
+
return initialValue !== undefined && initialValue !== null
|
|
19
|
+
? String(initialValue)
|
|
20
|
+
: '';
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const [infoVisible, setInfoVisible] = useState(false);
|
|
24
|
+
const [isInputFocused, setIsInputFocused] = useState(false);
|
|
25
|
+
const shakeAnimation = useRef(new Animated.Value(0)).current;
|
|
26
|
+
|
|
27
|
+
// Destructure props for easier access
|
|
28
|
+
const {
|
|
29
|
+
data = {},
|
|
30
|
+
callBack,
|
|
31
|
+
onEndEditCallback,
|
|
32
|
+
validationtype,
|
|
33
|
+
required = false,
|
|
34
|
+
disabled = false,
|
|
35
|
+
info,
|
|
36
|
+
CloseIcon,
|
|
37
|
+
CloseCallBack,
|
|
38
|
+
iconstyle,
|
|
39
|
+
inputstyle,
|
|
40
|
+
CCommonHeight,
|
|
41
|
+
CBorderWidth,
|
|
42
|
+
CIconCallBack,
|
|
43
|
+
custompositiontextviewstyle,
|
|
44
|
+
custompositiontextstyle,
|
|
45
|
+
...textInputProps
|
|
46
|
+
} = props;
|
|
47
|
+
|
|
48
|
+
// Merge default data with props data
|
|
49
|
+
const mergedData = {
|
|
50
|
+
// itemwidth: "100%",
|
|
51
|
+
displaytext: 'Name',
|
|
52
|
+
iconname: 'home',
|
|
53
|
+
type: 'default',
|
|
54
|
+
editable: true,
|
|
55
|
+
placeholder: '',
|
|
56
|
+
decimal: 2,
|
|
57
|
+
icongroup: 5,
|
|
58
|
+
tfontsize: normalize(14),
|
|
59
|
+
placeholdercolor: '#e1e1e1',
|
|
60
|
+
alignment: 'left',
|
|
61
|
+
...data,
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
// Handle external value changes
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
const newValue = props?.data?.value;
|
|
67
|
+
if (newValue !== undefined && newValue !== null) {
|
|
68
|
+
setText(String(newValue));
|
|
69
|
+
}
|
|
70
|
+
}, [props?.data?.value]);
|
|
71
|
+
|
|
72
|
+
// Keyboard listener
|
|
73
|
+
useEffect(() => {
|
|
74
|
+
const keyboardDidHideListener = Keyboard.addListener(
|
|
75
|
+
'keyboardDidHide',
|
|
76
|
+
() => {
|
|
77
|
+
if (isInputFocused) {
|
|
78
|
+
setIsInputFocused(false);
|
|
79
|
+
// Call any on blur callback if needed
|
|
80
|
+
if (onEndEditCallback && isNUQZ(validationtype)) {
|
|
81
|
+
onEndEditCallback(text);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
return () => {
|
|
88
|
+
keyboardDidHideListener.remove();
|
|
89
|
+
};
|
|
90
|
+
}, [isInputFocused, text, validationtype, onEndEditCallback]);
|
|
91
|
+
|
|
92
|
+
// Shake animation
|
|
93
|
+
const shake = useCallback(() => {
|
|
94
|
+
shakeAnimation.setValue(0);
|
|
95
|
+
Animated.sequence([
|
|
96
|
+
Animated.timing(shakeAnimation, {
|
|
97
|
+
toValue: 10,
|
|
98
|
+
duration: 50,
|
|
99
|
+
useNativeDriver: true,
|
|
100
|
+
}),
|
|
101
|
+
Animated.timing(shakeAnimation, {
|
|
102
|
+
toValue: -10,
|
|
103
|
+
duration: 50,
|
|
104
|
+
useNativeDriver: true,
|
|
105
|
+
}),
|
|
106
|
+
Animated.timing(shakeAnimation, {
|
|
107
|
+
toValue: 10,
|
|
108
|
+
duration: 50,
|
|
109
|
+
useNativeDriver: true,
|
|
110
|
+
}),
|
|
111
|
+
Animated.timing(shakeAnimation, {
|
|
112
|
+
toValue: 0,
|
|
113
|
+
duration: 50,
|
|
114
|
+
useNativeDriver: true,
|
|
115
|
+
}),
|
|
116
|
+
]).start();
|
|
117
|
+
}, [shakeAnimation]);
|
|
118
|
+
|
|
119
|
+
// Validation functions
|
|
120
|
+
const validateEmail = useCallback((email) => {
|
|
121
|
+
const emailRegex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
122
|
+
return emailRegex.test(email);
|
|
123
|
+
}, []);
|
|
124
|
+
|
|
125
|
+
const validateMobileNumber = useCallback((number) => {
|
|
126
|
+
const mobileRegex = /^\d{10}$/;
|
|
127
|
+
return mobileRegex.test(number);
|
|
128
|
+
}, []);
|
|
129
|
+
|
|
130
|
+
// Handle text change
|
|
131
|
+
const handleTextChange = useCallback((value) => {
|
|
132
|
+
setText(value);
|
|
133
|
+
if (callBack) {
|
|
134
|
+
callBack(value);
|
|
135
|
+
}
|
|
136
|
+
}, [callBack]);
|
|
137
|
+
|
|
138
|
+
// Handle end editing with validation
|
|
139
|
+
const handleEndEditing = useCallback(() => {
|
|
140
|
+
if (!isNUQZ(validationtype)) {return;}
|
|
141
|
+
|
|
142
|
+
let isValid = true;
|
|
143
|
+
|
|
144
|
+
switch (validationtype) {
|
|
145
|
+
case 1: // Email validation
|
|
146
|
+
isValid = validateEmail(text);
|
|
147
|
+
if (!isValid) {
|
|
148
|
+
shake();
|
|
149
|
+
handleTextChange('');
|
|
150
|
+
}
|
|
151
|
+
break;
|
|
152
|
+
|
|
153
|
+
case 2: // Mobile number validation
|
|
154
|
+
isValid = validateMobileNumber(text);
|
|
155
|
+
if (!isValid) {
|
|
156
|
+
shake();
|
|
157
|
+
handleTextChange('');
|
|
158
|
+
} else if (onEndEditCallback) {
|
|
159
|
+
onEndEditCallback(text);
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
|
|
163
|
+
case 3: // Generic callback
|
|
164
|
+
if (onEndEditCallback) {
|
|
165
|
+
onEndEditCallback(text);
|
|
166
|
+
}
|
|
167
|
+
break;
|
|
168
|
+
|
|
169
|
+
default:
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}, [validationtype, text, validateEmail, validateMobileNumber, onEndEditCallback, shake, handleTextChange]);
|
|
173
|
+
|
|
174
|
+
// Handle clear button
|
|
175
|
+
const handleClear = useCallback(() => {
|
|
176
|
+
handleTextChange('');
|
|
177
|
+
if (CloseCallBack) {
|
|
178
|
+
CloseCallBack(true);
|
|
179
|
+
}
|
|
180
|
+
}, [handleTextChange, CloseCallBack]);
|
|
181
|
+
|
|
182
|
+
// Handle icon press
|
|
183
|
+
const handleIconPress = useCallback(() => {
|
|
184
|
+
if (CIconCallBack) {
|
|
185
|
+
CIconCallBack(mergedData);
|
|
186
|
+
}
|
|
187
|
+
}, [CIconCallBack, mergedData]);
|
|
188
|
+
|
|
189
|
+
// Calculate styles
|
|
190
|
+
const containerStyle = inputstyle || {
|
|
191
|
+
flexDirection: 'row',
|
|
192
|
+
borderWidth: CBorderWidth ?? 1,
|
|
193
|
+
borderColor: 'lightgrey',
|
|
194
|
+
borderRadius: 10,
|
|
195
|
+
alignItems: 'center',
|
|
196
|
+
height: CCommonHeight ?? normalize(35),
|
|
197
|
+
};
|
|
198
|
+
|
|
199
|
+
const labelViewStyle = custompositiontextviewstyle || {
|
|
200
|
+
position: 'absolute',
|
|
201
|
+
top: normalize(-6),
|
|
202
|
+
left: normalize(10),
|
|
203
|
+
backgroundColor: 'white',
|
|
204
|
+
flexDirection: 'row',
|
|
205
|
+
alignItems: 'center',
|
|
206
|
+
zIndex: 1,
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
const labelTextStyle = custompositiontextstyle || {
|
|
210
|
+
color: '#164c92',
|
|
211
|
+
fontSize: normalize(10),
|
|
212
|
+
textAlign: 'left',
|
|
213
|
+
fontWeight: 'normal',
|
|
214
|
+
};
|
|
215
|
+
|
|
216
|
+
const textInputStyle = {
|
|
217
|
+
borderWidth: 0,
|
|
218
|
+
flex: 1,
|
|
219
|
+
paddingRight: normalize(5),
|
|
220
|
+
fontSize: mergedData.tfontsize,
|
|
221
|
+
height: mergedData.textarea ? normalize(60) : normalize(35),
|
|
222
|
+
color: 'black',
|
|
223
|
+
fontWeight: mergedData.tfontweight || 'normal',
|
|
224
|
+
textAlign: mergedData.alignment,
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
return (
|
|
228
|
+
<Animated.View style={{
|
|
229
|
+
width: mergedData.itemwidth,
|
|
230
|
+
marginVertical: normalize(5),
|
|
231
|
+
transform: [{ translateX: shakeAnimation }],
|
|
232
|
+
}}>
|
|
233
|
+
{/* Floating Label */}
|
|
234
|
+
{isNUQ(mergedData.displaytext) && (
|
|
235
|
+
<View style={labelViewStyle}>
|
|
236
|
+
<Text style={labelTextStyle}>
|
|
237
|
+
{mergedData.displaytext}
|
|
238
|
+
</Text>
|
|
239
|
+
{required && (
|
|
240
|
+
<Text style={{ color: 'red', fontSize: normalize(10) }}>
|
|
241
|
+
{' *'}
|
|
242
|
+
</Text>
|
|
243
|
+
)}
|
|
244
|
+
</View>
|
|
245
|
+
)}
|
|
246
|
+
|
|
247
|
+
{/* Input Container */}
|
|
248
|
+
<View style={containerStyle}>
|
|
249
|
+
{/* Icon */}
|
|
250
|
+
{iconstyle && (
|
|
251
|
+
<HOCIcons.Icons
|
|
252
|
+
icongroup={iconstyle.icongroup ?? 5}
|
|
253
|
+
name={iconstyle.iconname ?? 'file-alt'}
|
|
254
|
+
size={iconstyle.iconsize ?? normalize(15)}
|
|
255
|
+
color={iconstyle.iconcolor ?? 'darkblue'}
|
|
256
|
+
style={iconstyle.style ?? { paddingHorizontal: 5 }}
|
|
257
|
+
onPress={handleIconPress}
|
|
258
|
+
/>
|
|
259
|
+
)}
|
|
260
|
+
|
|
261
|
+
{/* TextInput */}
|
|
262
|
+
<TextInput
|
|
263
|
+
style={textInputStyle}
|
|
264
|
+
value={text}
|
|
265
|
+
onChangeText={handleTextChange}
|
|
266
|
+
onFocus={() => {
|
|
267
|
+
setIsInputFocused(true);
|
|
268
|
+
setInfoVisible(true);
|
|
269
|
+
}}
|
|
270
|
+
onBlur={() => {
|
|
271
|
+
setIsInputFocused(false);
|
|
272
|
+
setInfoVisible(false);
|
|
273
|
+
handleEndEditing();
|
|
274
|
+
}}
|
|
275
|
+
autoCapitalize={mergedData.capitalize || 'none'}
|
|
276
|
+
keyboardType={mergedData.type}
|
|
277
|
+
maxLength={mergedData.maxlength || 200}
|
|
278
|
+
editable={!disabled}
|
|
279
|
+
multiline={!!mergedData.textarea}
|
|
280
|
+
numberOfLines={mergedData.textarea ? 5 : 1}
|
|
281
|
+
placeholder={mergedData.placeholder || ''}
|
|
282
|
+
placeholderTextColor={mergedData.placeholdercolor}
|
|
283
|
+
spellCheck={false}
|
|
284
|
+
autoCorrect={false}
|
|
285
|
+
{...textInputProps}
|
|
286
|
+
/>
|
|
287
|
+
|
|
288
|
+
{/* Clear Button */}
|
|
289
|
+
{CloseIcon && (
|
|
290
|
+
<TouchableOpacity onPress={handleClear}>
|
|
291
|
+
<HOCIcons.MaterialCommunityIcons
|
|
292
|
+
name={'close-circle'}
|
|
293
|
+
color={Global.AppTheme.primary_color}
|
|
294
|
+
size={normalize(18)}
|
|
295
|
+
style={{ marginHorizontal: normalize(5) }}
|
|
296
|
+
/>
|
|
297
|
+
</TouchableOpacity>
|
|
298
|
+
)}
|
|
299
|
+
</View>
|
|
300
|
+
|
|
301
|
+
{/* Info Text */}
|
|
302
|
+
{(infoVisible && isNU(info)) && (
|
|
303
|
+
<View style={{
|
|
304
|
+
marginTop: normalize(3),
|
|
305
|
+
borderRadius: 5,
|
|
306
|
+
borderWidth: 0,
|
|
307
|
+
width: '100%',
|
|
308
|
+
flexDirection: 'row',
|
|
309
|
+
alignItems: 'center',
|
|
310
|
+
}}>
|
|
311
|
+
<HOCIcons.Entypo
|
|
312
|
+
icongroup={5}
|
|
313
|
+
name={'info-with-circle'}
|
|
314
|
+
size={normalize(10)}
|
|
315
|
+
color={'grey'}
|
|
316
|
+
style={{ textAlign: 'center', paddingHorizontal: normalize(3) }}
|
|
317
|
+
/>
|
|
318
|
+
<Text
|
|
319
|
+
adjustsFontSizeToFit
|
|
320
|
+
style={{
|
|
321
|
+
width: '90%',
|
|
322
|
+
color: 'grey',
|
|
323
|
+
fontStyle: 'italic',
|
|
324
|
+
fontSize: normalize(9),
|
|
325
|
+
textAlign: 'left',
|
|
326
|
+
}}
|
|
327
|
+
>
|
|
328
|
+
{' '}{info}
|
|
329
|
+
</Text>
|
|
330
|
+
</View>
|
|
331
|
+
)}
|
|
332
|
+
</Animated.View>
|
|
333
|
+
);
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
export default memo(CCustomTextInput);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleSheet, View, ImageBackground, ScrollView } from 'react-native';
|
|
3
|
+
import { APIURL } from '../../../../../src/Common/apiConstants';
|
|
4
|
+
|
|
5
|
+
const CDetailView = (props) => {
|
|
6
|
+
const styles = StyleSheet.create({
|
|
7
|
+
CDetailView: {
|
|
8
|
+
flex: 1,
|
|
9
|
+
shadowColor: '#000',
|
|
10
|
+
shadowOffset: { width: 0, height: 2 },
|
|
11
|
+
shadowOpacity: 0.8,
|
|
12
|
+
shadowRadius: 2,
|
|
13
|
+
borderTopLeftRadius: 20,
|
|
14
|
+
borderTopRightRadius: 20,
|
|
15
|
+
width: '100%',
|
|
16
|
+
backgroundColor: props.backgroundColor ? props.backgroundColor : 'white',
|
|
17
|
+
},
|
|
18
|
+
image: {
|
|
19
|
+
flex: 1,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<View style={styles.CDetailView}>
|
|
26
|
+
<ImageBackground
|
|
27
|
+
source={props.bgimage != undefined ? { uri: props.bgimage } : { uri: `${APIURL}file/getCommonFile/image/IMA.png` }}
|
|
28
|
+
resizeMode={props.bgimage != undefined ? 'stretch' : 'contain'}
|
|
29
|
+
imageStyle={props.bgimage != undefined ? { opacity: 1 } : { opacity: 0.1 }}
|
|
30
|
+
style={styles.image}
|
|
31
|
+
>
|
|
32
|
+
{props.children}
|
|
33
|
+
</ImageBackground>
|
|
34
|
+
</View>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export default CDetailView;
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { View, Text, FlatList } from 'react-native';
|
|
3
|
+
import { notifyMessage, Loader, isBNUL, isNU } from '../CommonStyle/ComponentFunctions';
|
|
4
|
+
import { NetworkServiceCall } from '@jescon-technologies/react-native-ui-kit';
|
|
5
|
+
import HOCIcons from '../HOC/HOCIcons';
|
|
6
|
+
import {
|
|
7
|
+
MenuOption,
|
|
8
|
+
} from 'react-native-popup-menu';
|
|
9
|
+
import { normalize } from '../CommonStyle/componentStyle';
|
|
10
|
+
|
|
11
|
+
export default function CDropDownList(props) {
|
|
12
|
+
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
FetchDropdownList();
|
|
15
|
+
}, []);
|
|
16
|
+
|
|
17
|
+
const [loading, setLoading] = useState(false);
|
|
18
|
+
const [displayData, setDisplayData] = useState([]);
|
|
19
|
+
const [refresh, setRefresh] = useState(0);
|
|
20
|
+
const [searchData, setSearchData] = useState('');
|
|
21
|
+
|
|
22
|
+
function FetchDropdownList() {
|
|
23
|
+
setDisplayData([]);
|
|
24
|
+
setLoading(true);
|
|
25
|
+
props.dropdownapi && props.dropdownapi != null && props.dropdownapi != undefined ?
|
|
26
|
+
(console.log('CDropDownList props.dropdownapi', props.dropdownapi),
|
|
27
|
+
NetworkServiceCall('get', props.dropdownapi, '').then(
|
|
28
|
+
function (response) {
|
|
29
|
+
// console.log('CDropDownList response', JSON.stringify(response))
|
|
30
|
+
if (
|
|
31
|
+
response.httpstatus &&
|
|
32
|
+
response.httpstatus != null &&
|
|
33
|
+
response.httpstatus != undefined &&
|
|
34
|
+
response.httpstatus == 200
|
|
35
|
+
) {
|
|
36
|
+
setDisplayData(response.data.data);
|
|
37
|
+
setLoading(false);
|
|
38
|
+
} else {
|
|
39
|
+
notifyMessage('Data Not Found');
|
|
40
|
+
setLoading(false);
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
))
|
|
44
|
+
: props.dropdownarray && props.dropdownarray != null && props.dropdownarray != undefined ?
|
|
45
|
+
(setDisplayData(props.dropdownarray), // Changed props.dropdownarray.data.data to props.dropdownarray
|
|
46
|
+
setLoading(false))
|
|
47
|
+
:
|
|
48
|
+
setLoading(false);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function renderItem(data) {
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<MenuOption
|
|
55
|
+
onSelect={() => {
|
|
56
|
+
data.item.selected = true,
|
|
57
|
+
setRefresh(refresh + 1),
|
|
58
|
+
props.callback(data.item);
|
|
59
|
+
}}
|
|
60
|
+
disabled={false}
|
|
61
|
+
style={{
|
|
62
|
+
paddingVertical: normalize(5),
|
|
63
|
+
borderWidth: 0.5,
|
|
64
|
+
borderColor: 'lightgrey',
|
|
65
|
+
flexDirection: 'row',
|
|
66
|
+
alignItems: 'center',
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
{data.item.hideicon ?
|
|
70
|
+
null
|
|
71
|
+
:
|
|
72
|
+
<HOCIcons.Icons
|
|
73
|
+
icongroup={isNU(data.item.icongroup) ? data.item.icongroup : 3}
|
|
74
|
+
name={data.item.icon ? data.item.icon : data.item.selected ? 'radiobox-marked' : 'circle-double'}//radiobox-marked
|
|
75
|
+
color={'black'}
|
|
76
|
+
size={normalize(10)}
|
|
77
|
+
style={{
|
|
78
|
+
marginRight: normalize(4),
|
|
79
|
+
borderWidth: 0,
|
|
80
|
+
textAlign: 'center',
|
|
81
|
+
}}
|
|
82
|
+
/>
|
|
83
|
+
}
|
|
84
|
+
{data.item.badgenumber != null && data.item.badgenumber != undefined ?
|
|
85
|
+
<View style={{ borderWidth: 0, borderRadius: 100, height: normalize(14), width: normalize(14), position: 'absolute', backgroundColor: '#912c2c', right: 0, top: 0, justifyContent: 'center', alignItems: 'center' }}>
|
|
86
|
+
<Text style={{ fontSize: normalize(10), textAlign: 'center', color: 'white' }}>{data.item.badgenumber}</Text>
|
|
87
|
+
</View>
|
|
88
|
+
: null}
|
|
89
|
+
|
|
90
|
+
<Text
|
|
91
|
+
style={{
|
|
92
|
+
borderWidth: 0,
|
|
93
|
+
fontWeight: data.item.selected ? 'bold' : 'normal',
|
|
94
|
+
fontSize: normalize(12),
|
|
95
|
+
color: 'black',
|
|
96
|
+
}}
|
|
97
|
+
>
|
|
98
|
+
{data.item.displayvalue != null && data.item.displayvalue != undefined ? data.item.displayvalue.toUpperCase() : null}
|
|
99
|
+
</Text>
|
|
100
|
+
</MenuOption>
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
function GetDropdown(data) {
|
|
105
|
+
const newDropDownData = data != undefined
|
|
106
|
+
? data.filter(function (item) {
|
|
107
|
+
const dataItem = item.displayvalue
|
|
108
|
+
? item.displayvalue.toUpperCase()
|
|
109
|
+
: ''.toUpperCase();
|
|
110
|
+
const textData = searchData.toUpperCase();
|
|
111
|
+
return dataItem.indexOf(textData) > -1;
|
|
112
|
+
})
|
|
113
|
+
: null;
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<FlatList
|
|
117
|
+
keyboardShouldPersistTaps={'handled'}
|
|
118
|
+
data={newDropDownData}
|
|
119
|
+
renderItem={renderItem}
|
|
120
|
+
ListFooterComponent={() => {
|
|
121
|
+
return (
|
|
122
|
+
<>
|
|
123
|
+
{isNU(props.info) ?
|
|
124
|
+
<View style={{ marginTop: normalize(3), borderRadius: 5, borderWidth: 0, width: '100%', borderColor: 'lightgrey', flexDirection: 'row', alignItems: 'center', backgroundColor: 'white' }}>
|
|
125
|
+
<HOCIcons.Entypo
|
|
126
|
+
icongroup={5}
|
|
127
|
+
name={'info-with-circle'}
|
|
128
|
+
size={normalize(12)}
|
|
129
|
+
color={'grey'}
|
|
130
|
+
style={{ textAlign: 'center', padding: normalize(3), paddingLeft: normalize(8) }}
|
|
131
|
+
/>
|
|
132
|
+
<Text adjustsFontSizeToFit style={{ width: '90%', color: 'grey', fontStyle: 'italic', fontSize: normalize(11), textAlign: 'left' }}>
|
|
133
|
+
{' '}{isNU(props.info) ? props.info : null}
|
|
134
|
+
</Text>
|
|
135
|
+
</View>
|
|
136
|
+
: null}
|
|
137
|
+
</>
|
|
138
|
+
);
|
|
139
|
+
}}
|
|
140
|
+
// estimatedItemSize={normalize(25)}
|
|
141
|
+
/>
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<View style={{ borderWidth: 0.5, borderRadius: 5, borderColor: 'lightgrey', backgroundColor: 'white' }}>
|
|
147
|
+
{loading ? <Loader /> : null}
|
|
148
|
+
{isBNUL(displayData) ?
|
|
149
|
+
GetDropdown(displayData)
|
|
150
|
+
: null}
|
|
151
|
+
</View>
|
|
152
|
+
);
|
|
153
|
+
}
|