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

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.
@@ -0,0 +1,265 @@
1
+ import axios from "axios";
2
+ import { isConnected, notifyMessage, ValueCheck } from "../CommonStyle/ComponentFunctions";
3
+ import { Global } from "./Global";
4
+ import { Platform } from "react-native";
5
+
6
+ export default NetworkServiceCall = (method, url, params, jwt, timeout) => {
7
+ let jwtString = ValueCheck(Global.JWTToken) ? Global.JWTToken : jwt
8
+ // console.log("----------------------------- JWT Key -----------------",jwt)
9
+ let dataset = {}
10
+ if (method.toLowerCase() === "get") {
11
+ return (
12
+ axios({
13
+ method: 'get',
14
+ url: url,
15
+ timeout: timeout || 60000,
16
+ validateStatus: false,
17
+ // headers: {
18
+ // Authorization: `Bearer ${jwtString}`,
19
+ // }
20
+ })
21
+ .then(function (response) {
22
+ // console.log("RESPPPPPPPPP GETTTTTTTTTTTTTT",JSON.stringify(response.data.httpstatus))
23
+ if (response.data.httpstatus == 200) {
24
+ dataset = {
25
+ data: response.data.data,
26
+ httpstatus: response.data.httpstatus
27
+ }
28
+ return dataset
29
+ }
30
+ else {
31
+ dataset = {
32
+ httpstatus: response.data.httpstatus,
33
+ data: {
34
+ title: "ERROR",
35
+ subtitle: response.data.data != undefined ? response.data.data.message : "",
36
+ alertdata: {
37
+ alertCaption: "ERROR",
38
+ alertMessage: response.data.message,
39
+ alertContent: response.data.message,
40
+ alertHttpstatus: response.data.httpstatus,
41
+ }
42
+ }
43
+ }
44
+ return dataset
45
+ }
46
+ })
47
+ .catch(function (error) {
48
+ // console.log("ERRRRROEERRRRRRR GETTTTTTTT",JSON.stringify(error))
49
+ dataset = {
50
+ httpstatus: 404,
51
+ data: {
52
+ title: "ERROR",
53
+ subtitle: "",
54
+ alertdata: {
55
+ alertCaption: "ERROR",
56
+ alertMessage: error.message,
57
+ alertContent: error.message,
58
+ alertHttpstatus: 404,
59
+ }
60
+ }
61
+ }
62
+ return dataset
63
+ })
64
+ )
65
+ }
66
+ else if (method.toLowerCase() === "post" && Platform.OS !== "web") {
67
+ // console.log("ANROIDDDDDDDDDDDDDDDDDDDDDDDD", Platform.OS)
68
+ return (
69
+ // isConnected()
70
+ // .then(() =>
71
+ axios.post(url, params, {
72
+ // headers: {
73
+ // Authorization: `Bearer ${jwtString}`,
74
+ // }
75
+ })
76
+ .then(function (response) {
77
+ // console.log("RESPONSE>>>>>>>>>>>>>>>>>>>>>>ON NETWORK SERVICE CALL",JSON.stringify(response))
78
+ if (response.data.httpstatus == 200) {
79
+ dataset = {
80
+ data: response.data.data,
81
+ httpstatus: response.data.httpstatus
82
+ }
83
+ return dataset
84
+ }
85
+ else {
86
+ dataset = {
87
+ httpstatus: response.data.httpstatus,
88
+ data: {
89
+ title: "ERROR",
90
+ subtitle: "",
91
+ alertdata: {
92
+ alertCaption: "ERROR",
93
+ alertMessage: response.data.message,
94
+ alertContent: response.data.message,
95
+ alertHttpstatus: response.data.httpstatus,
96
+ }
97
+ }
98
+ }
99
+ return dataset
100
+ }
101
+ })
102
+ .catch(function (error) {
103
+ // console.log("RESPONSE>>>>>>>>>>>>>>>>>>>>>>ON NETWORK SERVICE CALL ERRORRRR",JSON.stringify(error))
104
+ dataset = {
105
+ httpstatus: 404,
106
+ data: {
107
+ title: "ERROR",
108
+ subtitle: "",
109
+ alertdata: {
110
+ alertCaption: "ERROR",
111
+ alertMessage: error.message,
112
+ alertContent: error.message,
113
+ alertHttpstatus: 404,
114
+ }
115
+ }
116
+ }
117
+ return dataset
118
+ })
119
+
120
+ // )
121
+ // .catch(function (error) {
122
+ // notifyMessage("Please check your network connection and try again")
123
+ // dataset = {
124
+ // httpstatus: 344,
125
+ // data: {
126
+ // title: "ERROR",
127
+ // subtitle: "",
128
+ // alertdata: {
129
+ // alertCaption: "ERROR",
130
+ // alertMessage: "Connection Issue ",
131
+ // alertContent: "Check Internet Connectivity",
132
+ // alertHttpstatus: 344,
133
+ // }
134
+ // }
135
+ // }
136
+ // return dataset
137
+ // })
138
+ )
139
+ }
140
+ else if (method.toLowerCase() === "multiform" && !Platform.OS === "web") {
141
+ console.log("JWT STRING", jwtString)
142
+
143
+ return (
144
+ axios({
145
+ url: url,
146
+ method: 'POST',
147
+ headers: {
148
+ 'Content-Type': 'multipart/form-data',
149
+ // Authorization: `Bearer ${jwtString}`,
150
+ },
151
+ data: params
152
+ }).then(function (response) {
153
+ // console.log("Multi formmmmmmmmmmm retrieval........",response)
154
+ if (response.status == 200) {
155
+ dataset = {
156
+ data: response.data,
157
+ httpstatus: response.status
158
+ }
159
+ return dataset
160
+ }
161
+ else {
162
+ dataset = {
163
+ httpstatus: response.status,
164
+ data: {
165
+ title: "ERROR",
166
+ subtitle: "",
167
+ alertdata: {
168
+ alertCaption: "ERROR",
169
+ alertMessage: response.data.message,
170
+ alertContent: response.data.message,
171
+ alertHttpstatus: response.data.httpstatus,
172
+ }
173
+ }
174
+ }
175
+ return dataset
176
+ }
177
+ })
178
+ .catch((error) => {
179
+ dataset = {
180
+ httpstatus: 404,
181
+ data: {
182
+ title: "ERROR",
183
+ subtitle: "",
184
+ alertdata: {
185
+ alertCaption: "ERROR",
186
+ alertMessage: error.message,
187
+ alertContent: error.message,
188
+ alertHttpstatus: 404,
189
+ }
190
+ }
191
+ }
192
+ return dataset
193
+ })
194
+
195
+ )
196
+ }
197
+ else if (method.toLowerCase() === "post" && Platform.OS === "web") {
198
+ // console.log("WEBBBBBBBBBBBBBBBBBBBBBBBBBBBB", Platform.OS)
199
+ return (
200
+ window.electronAPI.networkCall('post', url, params)
201
+ .then(function (response) {
202
+ // console.log("RESPONSE>>>>>>>>>>>>>>>>>>>>>>ON NETWORK SERVICE CALL",JSON.stringify(response))
203
+ if (response.httpstatus == 200) {
204
+ dataset = {
205
+ data: response.data,
206
+ httpstatus: response.httpstatus
207
+ }
208
+ return dataset
209
+ }
210
+ else {
211
+ dataset = {
212
+ httpstatus: response.httpstatus,
213
+ data: {
214
+ title: "ERROR",
215
+ subtitle: "",
216
+ alertdata: {
217
+ alertCaption: "ERROR",
218
+ alertMessage: response.message,
219
+ alertContent: response.message,
220
+ alertHttpstatus: response.httpstatus,
221
+ }
222
+ }
223
+ }
224
+ return dataset
225
+ }
226
+ })
227
+ .catch(function (error) {
228
+ // console.log("RESPONSE>>>>>>>>>>>>>>>>>>>>>>ON NETWORK SERVICE CALL ERRORRRR",JSON.stringify(error))
229
+ dataset = {
230
+ httpstatus: 404,
231
+ data: {
232
+ title: "ERROR",
233
+ subtitle: "",
234
+ alertdata: {
235
+ alertCaption: "ERROR",
236
+ alertMessage: error.message,
237
+ alertContent: error.message,
238
+ alertHttpstatus: 404,
239
+ }
240
+ }
241
+ }
242
+ return dataset
243
+ })
244
+
245
+ // )
246
+ // .catch(function (error) {
247
+ // notifyMessage("Please check your network connection and try again")
248
+ // dataset = {
249
+ // httpstatus: 344,
250
+ // data: {
251
+ // title: "ERROR",
252
+ // subtitle: "",
253
+ // alertdata: {
254
+ // alertCaption: "ERROR",
255
+ // alertMessage: "Connection Issue ",
256
+ // alertContent: "Check Internet Connectivity",
257
+ // alertHttpstatus: 344,
258
+ // }
259
+ // }
260
+ // }
261
+ // return dataset
262
+ // })
263
+ )
264
+ }
265
+ }
@@ -0,0 +1,176 @@
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
+ } from "react-native";
12
+
13
+ import { normalize } from "react-native-elements";
14
+ import { APIURL } from "../Common/apiConstants";
15
+
16
+ export default function Loader({
17
+ visible = true,
18
+ overlayColor = 'rgba(0,0,0,0.4)',
19
+ loaderColor = 'lightblue',
20
+ size = 50,
21
+ gifSource = {uri:`${APIURL}insurancefile/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
+ />
80
+ ) : (
81
+ <Animated.View style={[
82
+ styles.defaultLoader,
83
+ {
84
+ borderColor: loaderColor,
85
+ transform: [{ rotate: spin }, { scale: pulse }],
86
+ width: normalize(size),
87
+ height: normalize(size),
88
+ borderWidth: normalize(size / 10)
89
+ }
90
+ ]}>
91
+ <View style={[
92
+ styles.innerCircle,
93
+ {
94
+ backgroundColor: loaderColor,
95
+ width: normalize(size / 2),
96
+ height: normalize(size / 2)
97
+ }
98
+ ]} />
99
+ </Animated.View>
100
+ );
101
+
102
+ return (
103
+ <Modal
104
+ animationType={animationType}
105
+ transparent={true}
106
+ visible={visible}
107
+ onRequestClose={() => {}}
108
+ >
109
+ <Animated.View style={[
110
+ styles.modalContainer,
111
+ {
112
+ backgroundColor: overlayColor,
113
+ opacity: fade
114
+ }
115
+ ]}>
116
+ <Animated.View style={[
117
+ styles.loaderContainer,
118
+ {
119
+ backgroundColor: hasBackground ? 'white' : 'transparent',
120
+ borderRadius: normalize(borderRadius),
121
+ transform: [{ scale: pulse }],
122
+ ...(shadow && styles.shadowStyle)
123
+ }
124
+ ]}>
125
+ {loaderContent}
126
+ {message ? (
127
+ <Text style={[styles.messageText, messageStyle]}>
128
+ {message}
129
+ </Text>
130
+ ) : null}
131
+ </Animated.View>
132
+ </Animated.View>
133
+ </Modal>
134
+ );
135
+ }
136
+
137
+ const styles = StyleSheet.create({
138
+ modalContainer: {
139
+ flex: 1,
140
+ justifyContent: 'center',
141
+ alignItems: 'center',
142
+ },
143
+ loaderContainer: {
144
+ padding: normalize(20),
145
+ justifyContent: 'center',
146
+ alignItems: 'center',
147
+ },
148
+ icon_style: {
149
+ justifyContent: "center",
150
+ alignItems: "center"
151
+ },
152
+ defaultLoader: {
153
+ borderRadius: normalize(100),
154
+ justifyContent: 'center',
155
+ alignItems: 'center',
156
+ },
157
+ innerCircle: {
158
+ borderRadius: normalize(100),
159
+ },
160
+ messageText: {
161
+ marginTop: normalize(15),
162
+ fontSize: normalize(14),
163
+ color: '#555',
164
+ textAlign: 'center'
165
+ },
166
+ shadowStyle: {
167
+ shadowColor: "#000",
168
+ shadowOffset: {
169
+ width: 0,
170
+ height: 2,
171
+ },
172
+ shadowOpacity: 0.25,
173
+ shadowRadius: 3.84,
174
+ elevation: 5,
175
+ }
176
+ });
package/src/index.js ADDED
@@ -0,0 +1,15 @@
1
+ export { default as CaptureImageWithoutEdit } from './components/CaptureImageWithoutEdit';
2
+ export { default as Card } from './components/Card';
3
+ export { default as CountdownTimer } from './components/CountdownTimer';
4
+ export { default as Loader } from './components/Loader';
5
+ export { default as Notification } from './components/Notification';
6
+ export { default as StepIndicator } from './components/StepIndicator';
7
+
8
+ export default {
9
+ CaptureImageWithoutEdit,
10
+ Card,
11
+ CountdownTimer,
12
+ Loader,
13
+ Notification,
14
+ StepIndicator,
15
+ };