@jescon-technologies/react-native-ui-kit 0.0.15 → 0.0.16

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 CHANGED
@@ -4,6 +4,7 @@ export { default as AAlert } from './src/Alerts/AAlert';
4
4
  export { default as ABlink } from './src/Alerts/ABlink';
5
5
  export { default as HIcons } from './src/Hoc/HIcons';
6
6
  export { default as HView } from './src/Hoc/HView';
7
+ export { default as HProvider } from './src/Hoc/HProvider';
7
8
  export { default as HShadowButton } from './src/Hoc/HShadowButton';
8
9
  export { default as Navigation } from './src/Navigation/PageNavigation';
9
10
  export { default as SSearchBar } from './src/StaticComponents/SSearchBar';
package/index.js CHANGED
@@ -4,6 +4,7 @@ export { default as AAlert } from './src/Alerts/AAlert';
4
4
  export { default as ABlink } from './src/Alerts/ABlink';
5
5
  export { default as HIcons } from './src/Hoc/HIcons';
6
6
  export { default as HView } from './src/Hoc/HView';
7
+ export { default as HProvider } from './src/Hoc/HProvider';
7
8
  export { default as HShadowButton } from './src/Hoc/HShadowButton';
8
9
  export { default as Navigation } from './src/Navigation/PageNavigation';
9
10
  export { default as SSearchBar } from './src/StaticComponents/SSearchBar';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jescon-technologies/react-native-ui-kit",
3
- "version": "0.0.15",
3
+ "version": "0.0.16",
4
4
  "description": "A React Native module for Jescon Technologies that provides react-native-ui-kit",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -9,6 +9,7 @@ import {
9
9
  } from 'react-native';
10
10
 
11
11
  import { Global } from '../../../../../src/Common/Global';
12
+ ;
12
13
  import HIcons from '../Hoc/HIcons';
13
14
  import { ValueCheck } from '../CommonStyle/ComponentFunctions';
14
15
  import { normalize } from '../CommonStyle/componentStyle';
@@ -8,6 +8,7 @@ import {
8
8
  } from 'react-native';
9
9
 
10
10
  import { Global } from '../../../../../src/Common/Global';
11
+ ;
11
12
  import HIcons from '../Hoc/HIcons';
12
13
  import { ValueCheck } from '../CommonStyle/ComponentFunctions';
13
14
  import { normalize } from '../CommonStyle/componentStyle';
@@ -1,6 +1,7 @@
1
1
  import axios, { Method, AxiosResponse, AxiosError } from 'axios';
2
2
  import { isConnected, notifyMessage, ValueCheck } from '../CommonStyle/ComponentFunctions';
3
- import { Global } from '../Common/Global';
3
+ import { Global } from '../../../../../src/Common/Global';
4
+ ;
4
5
  import { Platform } from 'react-native';
5
6
 
6
7
  // Type definitions
@@ -16,7 +16,8 @@ import {
16
16
  ImageStyle,
17
17
  } from 'react-native';
18
18
  import NetInfo from '@react-native-community/netinfo';
19
- import { Global } from '../Common/Global';
19
+ import { Global } from '../../../../../src/Common/Global';
20
+ ;
20
21
  import React from 'react';
21
22
 
22
23
  const {
@@ -1,10 +1,355 @@
1
- import { View, Text } from 'react-native'
2
- import React from 'react'
1
+ import React from 'react';
2
+ import {
3
+ Dimensions,
4
+ Image,
5
+ KeyboardAvoidingView,
6
+ ScrollView,
7
+ Platform,
8
+ TouchableOpacity,
9
+ View,
10
+ Text,
11
+ TextInput,
12
+ TouchableWithoutFeedback,
13
+ } from 'react-native';
14
+ import { Global } from '../../../../../src/Common/Global';
15
+ ;
16
+ import { normalize } from '../CommonStyle/componentStyle';
17
+ import { isPermitted, notifyMessage, ValueCheck } from '../CommonStyle/ComponentFunctions';
18
+ import Barcode from '@kichiyaki/react-native-barcode-generator';
19
+ import { useNavigation } from '../Navigation/useNavigation';
20
+ import HIcons from '../HOC/HIcons';
21
+
22
+ // ---------------------------------------------------------------------------
23
+ // Types
24
+ // ---------------------------------------------------------------------------
25
+
26
+ export interface OUserViewProps {
27
+ /** Called with `false` to close the parent overlay / modal. */
28
+ visibility?: (val: boolean) => void;
29
+ /**
30
+ * Base URL prepended to `Global.userData.signatureurl`.
31
+ * NOTE: this should really be imported from `apiConstants` instead of being
32
+ * passed as a prop — if the caller forgets, `undefined/...` becomes the URI.
33
+ */
34
+ APIURL?: string;
35
+ [key: string]: unknown;
36
+ }
37
+
38
+ // Extend the shared `GlobalUserData` with fields used here.
39
+ interface OUserViewUserData extends Global {
40
+ registrationno?: string;
41
+ designation?: string;
42
+ hrenemp?: string | number;
43
+ qualification?: string;
44
+ experience?: string | number;
45
+ mobileno?: string | number;
46
+ photo?: string;
47
+ signatureurl?: string;
48
+ wardname?: string;
49
+ wardcode?: string | number;
50
+ }
51
+
52
+ // ---------------------------------------------------------------------------
53
+ // Component
54
+ // ---------------------------------------------------------------------------
55
+
56
+ const OUserView: React.FC<OUserViewProps> = (props) => {
57
+ const navigation = useNavigation();
58
+ const userData = Global.userData as OUserViewUserData | null | undefined;
59
+
60
+ function fnSignatureEdit(): void {
61
+ if (isPermitted()) {
62
+ try {
63
+ props.visibility?.(false);
64
+ navigation.navigate('CSignatureScreen');
65
+ } catch (error) {
66
+ notifyMessage('cancelled');
67
+ }
68
+ } else {
69
+ notifyMessage('Storage Permission required.');
70
+ }
71
+ }
3
72
 
4
- export default function OUserView() {
5
73
  return (
6
- <View>
7
- <Text>OUserView</Text>
8
- </View>
9
- )
10
- }
74
+ <KeyboardAvoidingView
75
+ behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
76
+ style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}
77
+ >
78
+ <View style={{ flex: 1, width: Dimensions.get('screen').width - normalize(10) }}>
79
+ <Text
80
+ style={{
81
+ fontSize: normalize(12),
82
+ fontWeight: 'bold',
83
+ alignSelf: 'center',
84
+ marginTop: normalize(-15),
85
+ }}
86
+ >
87
+ User Details
88
+ </Text>
89
+ <TouchableWithoutFeedback>
90
+ <ScrollView style={{ marginBottom: normalize(45) }}>
91
+ <View style={{ borderWidth: 0 }}>
92
+ {/* Header card */}
93
+ <View
94
+ style={{
95
+ backgroundColor: '#2A81FF',
96
+ borderTopLeftRadius: 20,
97
+ // ⚠️ `borderTopEndRadius` is NOT a valid RN style key
98
+ // (standard is `borderTopRightRadius`). Silently ignored at
99
+ // runtime — top-right corner stays square. Preserved to
100
+ // match existing visual output.
101
+ height: normalize(55),
102
+ borderLeftWidth: 3,
103
+ borderColor: Global.AppTheme.primary_color,
104
+ }}
105
+ >
106
+ <View
107
+ style={{
108
+ paddingHorizontal: 10,
109
+ paddingVertical: 5,
110
+ flexDirection: 'row',
111
+ justifyContent: 'space-between',
112
+ }}
113
+ >
114
+ <View>
115
+ <TextInput
116
+ editable={false}
117
+ style={{
118
+ fontSize: normalize(14),
119
+ fontWeight: 'bold',
120
+ color: '#fff',
121
+ padding: 0,
122
+ }}
123
+ value={userData?.registrationno ?? ''}
124
+ />
125
+ <TextInput
126
+ editable={false}
127
+ style={{
128
+ fontSize: normalize(10),
129
+ fontWeight: 'bold',
130
+ color: '#fff',
131
+ padding: 0,
132
+ }}
133
+ value={userData?.department ?? ''}
134
+ />
135
+ <TextInput
136
+ editable={false}
137
+ style={{
138
+ fontSize: normalize(10),
139
+ fontWeight: 'bold',
140
+ color: '#fff',
141
+ padding: 0,
142
+ }}
143
+ value={userData?.designation ?? ''}
144
+ />
145
+ </View>
146
+ <View>
147
+ {Platform.OS !== 'web' && (
148
+ <Barcode
149
+ lineColor={Global.AppTheme.primary_color}
150
+ // ⚠️ 'CODE128B' is not in the library's `format` union.
151
+ // Cast is intentional — verify at runtime.
152
+ format={'CODE128B' as unknown as 'CODE128'}
153
+ value={
154
+ ValueCheck(userData)
155
+ ? String(userData?.hrenemp ?? '')
156
+ : ''
157
+ }
158
+ maxWidth={normalize(145)}
159
+ height={normalize(45)}
160
+ />
161
+ )}
162
+ </View>
163
+ </View>
164
+ </View>
165
+
166
+ {/* Body card */}
167
+ <View
168
+ style={{
169
+ flexDirection: 'row',
170
+ borderLeftWidth: 3,
171
+ borderColor: Global.AppTheme.primary_color,
172
+ borderBottomWidth: 3,
173
+ borderBottomEndRadius: 20,
174
+ borderBottomLeftRadius: 20,
175
+ justifyContent: 'flex-start',
176
+ alignItems: 'flex-start',
177
+ backgroundColor: '#d4e4f9',
178
+ width: '100%',
179
+ }}
180
+ >
181
+ {/* Left column — edit photo hint */}
182
+ <View
183
+ style={{
184
+ borderWidth: 0,
185
+ width: '25%',
186
+ alignItems: 'center',
187
+ justifyContent: 'center',
188
+ paddingTop: normalize(5),
189
+ }}
190
+ >
191
+ <View
192
+ style={{
193
+ borderRadius: 5,
194
+ borderWidth: 0,
195
+ width: '100%',
196
+ borderColor: 'lightgrey',
197
+ flexDirection: 'row',
198
+ alignItems: 'center',
199
+ }}
200
+ >
201
+ <HIcons.Entypo
202
+ icongroup={5}
203
+ name={'info-with-circle'}
204
+ size={normalize(8)}
205
+ color={'grey'}
206
+ style={{ textAlign: 'center', paddingHorizontal: normalize(5) }}
207
+ />
208
+ <Text
209
+ adjustsFontSizeToFit
210
+ style={{
211
+ width: '90%',
212
+ color: 'grey',
213
+ fontStyle: 'italic',
214
+ fontSize: normalize(8),
215
+ textAlign: 'left',
216
+ }}
217
+ >
218
+ {'Edit profile Photo.'}
219
+ </Text>
220
+ </View>
221
+ </View>
222
+
223
+ {/* Right column — user fields */}
224
+ <View
225
+ style={{
226
+ paddingLeft: normalize(5),
227
+ paddingTop: normalize(5),
228
+ borderWidth: 0,
229
+ width: '75%',
230
+ }}
231
+ >
232
+ <TextInput
233
+ editable={false}
234
+ style={{
235
+ fontSize: normalize(18),
236
+ fontWeight: 'bold',
237
+ color: 'black',
238
+ padding: 0,
239
+ }}
240
+ value={userData?.username ?? ''}
241
+ />
242
+ <TextInput
243
+ editable={false}
244
+ style={{
245
+ fontSize: normalize(12),
246
+ fontWeight: 'bold',
247
+ color: 'black',
248
+ paddingTop: 2,
249
+ padding: 0,
250
+ }}
251
+ value={userData?.qualification ?? ''}
252
+ />
253
+ <TextInput
254
+ editable={false}
255
+ style={{
256
+ fontSize: normalize(12),
257
+ fontWeight: 'bold',
258
+ color: 'black',
259
+ paddingTop: 2,
260
+ padding: 0,
261
+ }}
262
+ value={
263
+ userData?.experience != null ? String(userData.experience) : ''
264
+ }
265
+ />
266
+ <TextInput
267
+ editable={false}
268
+ style={{
269
+ fontSize: normalize(12),
270
+ fontWeight: 'bold',
271
+ color: 'black',
272
+ paddingTop: 2,
273
+ padding: 0,
274
+ }}
275
+ value={userData?.mobileno != null ? String(userData.mobileno) : ''}
276
+ />
277
+ <TouchableOpacity
278
+ disabled={false}
279
+ onPress={fnSignatureEdit}
280
+ style={{
281
+ borderWidth: 1,
282
+ backgroundColor: 'white',
283
+ borderRadius: 10,
284
+ borderColor: 'lightgrey',
285
+ elevation: 2,
286
+ width: normalize(150),
287
+ height: normalize(50),
288
+ }}
289
+ >
290
+ <Image
291
+ style={{
292
+ width: normalize(150),
293
+ height: normalize(50),
294
+ borderRadius: 10,
295
+ resizeMode: 'stretch',
296
+ }}
297
+ source={{
298
+ uri: `${props.APIURL ?? ''}${userData?.signatureurl ?? ''}`,
299
+ }}
300
+ />
301
+ <Text
302
+ style={{
303
+ position: 'absolute',
304
+ fontSize: normalize(15),
305
+ width: '100%',
306
+ textAlign: 'center',
307
+ bottom: normalize(15),
308
+ color: '#ebebebff',
309
+ }}
310
+ >
311
+ S I G N A T U R E
312
+ </Text>
313
+ </TouchableOpacity>
314
+ <View
315
+ style={{
316
+ marginTop: normalize(3),
317
+ borderRadius: 5,
318
+ borderWidth: 0,
319
+ width: '100%',
320
+ borderColor: 'lightgrey',
321
+ flexDirection: 'row',
322
+ alignItems: 'center',
323
+ }}
324
+ >
325
+ <HIcons.Entypo
326
+ icongroup={5}
327
+ name={'info-with-circle'}
328
+ size={normalize(8)}
329
+ color={'grey'}
330
+ style={{ textAlign: 'center', paddingHorizontal: normalize(5) }}
331
+ />
332
+ <Text
333
+ adjustsFontSizeToFit
334
+ style={{
335
+ width: '90%',
336
+ color: 'grey',
337
+ fontStyle: 'italic',
338
+ fontSize: normalize(8),
339
+ textAlign: 'left',
340
+ }}
341
+ >
342
+ {'Tap to edit signature.'}
343
+ </Text>
344
+ </View>
345
+ </View>
346
+ </View>
347
+ </View>
348
+ </ScrollView>
349
+ </TouchableWithoutFeedback>
350
+ </View>
351
+ </KeyboardAvoidingView>
352
+ );
353
+ };
354
+
355
+ export default OUserView;
@@ -10,7 +10,8 @@ import {
10
10
  TextStyle,
11
11
  ViewStyle,
12
12
  } from 'react-native';
13
- import { Global } from '../Common/Global';
13
+ import { Global } from '../../../../../src/Common/Global';
14
+ ;
14
15
  import { normalize } from '../CommonStyle/componentStyle';
15
16
  import Svg, { Rect, Defs, LinearGradient, Stop } from 'react-native-svg';
16
17
  import HIcons from '../Hoc/HIcons';
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Platform, StyleSheet, View, ViewStyle } from 'react-native';
3
- import { Global } from '../Common/Global';
3
+ import { Global } from '../../../../../src/Common/Global';
4
+ ;
4
5
 
5
6
  // ---------------------------------------------------------------------------
6
7
  // Types
@@ -9,11 +9,10 @@ import {
9
9
  ImageStyle,
10
10
  TextStyle,
11
11
  } from 'react-native';
12
- import { Global } from '../Common/Global';
12
+ import { Global } from '../../../../../src/Common/Global';
13
13
  // import CSwipeCard from '../Components/CSwipeCard';
14
14
  import { normalize } from '../CommonStyle/ComponentFunctions';
15
15
  import { useNavigation } from '../Navigation/PageNavigation';
16
-
17
16
  // ---------------------------------------------------------------------------
18
17
  // Types
19
18
  // ---------------------------------------------------------------------------
@@ -10,7 +10,8 @@ import {
10
10
  ViewStyle,
11
11
  } from 'react-native';
12
12
  import { normalize } from '../CommonStyle/componentStyle';
13
- import { Global } from '../Common/Global';
13
+ import { Global } from '../../../../../src/Common/Global';
14
+ ;
14
15
  import HIcons from '../Hoc/HIcons';
15
16
 
16
17
  // ---------------------------------------------------------------------------
@@ -17,10 +17,9 @@ import {
17
17
  ViewStyle,
18
18
  DimensionValue,
19
19
  } from 'react-native';
20
- import { Global } from '../Common/Global';
21
20
  import CSliderMenu from '../Custom/CSliderMenu';
22
21
  import { normalize } from '../CommonStyle/componentStyle';
23
- import { NotificationContext } from '@jescon-technologies/react-native-ui-kit/src/Handlers/NotificationsContext';
22
+ import { useNotifications } from '../Handlers/NotificationsContext';
24
23
  import moment from 'moment';
25
24
  import { ValueCheck } from '../CommonStyle/ComponentFunctions';
26
25
  import ABlink from '../Alerts/ABlink';
@@ -33,6 +32,8 @@ import { useNavigation } from '../Navigation/useNavigation';
33
32
  import NetworkServiceCall from '../Common/NetworkServiceCall';
34
33
  import HIcons from '../Hoc/HIcons';
35
34
  import ResponseComponentContext from '../Handlers/ResponseComponentContext';
35
+ import { Global } from '../../../../../src/Common/Global';
36
+ import { APIURL } from '../../../../../src/Common/apiConstants';
36
37
 
37
38
  // import HelpdeskScreenFocus from '../Helpdesk/View/HelpdeskScreenFocus';
38
39
  // import CHelpdeskView from '../Helpdesk/View/CHelpdeskView';
@@ -349,7 +350,7 @@ const HeaderBlock: React.FC<HeaderBlockProps> = (props) => {
349
350
 
350
351
  const OverlayHOCComponent = COverlay(OUserView) as unknown as OverlayComponent;
351
352
 
352
- const NoticationData = React.useContext(NotificationContext) as NotificationItem[];
353
+ const NoticationData = useNotifications() as NotificationItem[] | undefined;
353
354
 
354
355
  const result = NoticationData.filter((obj) => obj.status === true);
355
356
 
@@ -460,6 +461,8 @@ const HeaderBlock: React.FC<HeaderBlockProps> = (props) => {
460
461
 
461
462
  const userData = Global.userData as UserDataLite | null | undefined;
462
463
 
464
+ console.log('userData in HeaderBlock:', JSON.stringify(userData));
465
+
463
466
  const renderUserInfo = (): React.ReactElement => (
464
467
  <TouchableOpacity
465
468
  onPress={() => (props.webview != undefined ? null : setOverlay(true))}
@@ -470,13 +473,13 @@ const HeaderBlock: React.FC<HeaderBlockProps> = (props) => {
470
473
  {props.webview != undefined
471
474
  ? ''
472
475
  : userData && userData.department != undefined && userData.department != ''
473
- ? userData.username
474
- : ''}
476
+ ? userData.username
477
+ : ''}
475
478
  </Text>
476
479
  {userData &&
477
- userData.department != undefined &&
478
- userData.department != '' &&
479
- props.webview == undefined ? (
480
+ userData.department != undefined &&
481
+ userData.department != '' &&
482
+ props.webview == undefined ? (
480
483
  <Text adjustsFontSizeToFit style={styles.departmentText}>
481
484
  {userData.department}
482
485
  </Text>
@@ -31,7 +31,8 @@ import { notifyMessage } from '../CommonStyle/ComponentFunctions';
31
31
  import HShadowButton from './HShadowButton';
32
32
  import HIcons from './HIcons';
33
33
  import { normalize } from '../CommonStyle/componentStyle';
34
- import { Global } from '../Common/Global';
34
+ import { Global } from '../../../../../src/Common/Global';
35
+ ;
35
36
  import SDateTimePicker from '../StaticComponents/SDateTimePicker';
36
37
 
37
38
  // ---------------------------------------------------------------------------
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import HView from '../Hoc/HView';
3
+ import Navigation from '../Navigation/PageNavigation';
4
+ import ErrorBoundary from '../Common/ErrorBoundary';
5
+
6
+ interface HProviderProps {
7
+ components: Record<string, React.ComponentType<any>>;
8
+ screens: any;
9
+ }
10
+ export default function HProvider(props: HProviderProps) {
11
+ return (
12
+ <ErrorBoundary>
13
+ <HView components={props.components}>
14
+ <Navigation screens={props.screens} />
15
+ </HView>
16
+ </ErrorBoundary>
17
+ );
18
+ }
@@ -1,7 +1,8 @@
1
1
  import { StyleProp, Text, TextStyle, TouchableOpacity, ViewStyle } from 'react-native';
2
2
  import { isBNU, isNU, isNUQ, normalize } from '../CommonStyle/ComponentFunctions';
3
3
  import HIcons from './HIcons';
4
- import { Global } from '../Common/Global';
4
+ import { Global } from '../../../../../src/Common/Global';
5
+ ;
5
6
  import React from 'react';
6
7
 
7
8
  // ---------------------------------------------------------------------------
@@ -15,7 +15,8 @@ import HIcons from '../Hoc/HIcons';
15
15
  import moment from 'moment';
16
16
  import { normalize } from '../CommonStyle/componentStyle';
17
17
  import { isNU, ValueCheck } from '../CommonStyle/ComponentFunctions';
18
- import { Global } from '../Common/Global';
18
+ import { Global } from '../../../../../src/Common/Global';
19
+ ;
19
20
 
20
21
  // ---------------------------------------------------------------------------
21
22
  // Types
@@ -1,10 +0,0 @@
1
- export class Global {
2
- static AppTheme: Record<string, string> = {
3
- primary_color: '#094485',
4
- secondary_color: 'black',
5
- text_color: '#fff',
6
- heading_text_color: 'darkblue',
7
- bg_button: '#fff',
8
- icon_color: 'darkblue',
9
- };
10
- }