@jescon-technologies/react-native-ui-kit 0.0.7 → 0.0.9

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/.gitattributes ADDED
@@ -0,0 +1,2 @@
1
+ # Auto detect text files and perform LF normalization
2
+ * text=auto
package/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { default as ErrorBoundary } from './src/Common/ErrorBoundary';
2
+ export { default as AAlertIOS } from './Alerts/AAlertIOS';
3
+ export { default as AAlert } from './Alerts/AAlert';
package/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { default as ErrorBoundary } from './src/Common/ErrorBoundary';
2
+ export { default as AAlertIOS } from './Alerts/AAlertIOS';
3
+ export { default as AAlert } from './Alerts/AAlert';
package/package.json CHANGED
@@ -1,12 +1,10 @@
1
1
  {
2
2
  "name": "@jescon-technologies/react-native-ui-kit",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "A React Native module for Jescon Technologies that provides react-native-ui-kit",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
7
  "scripts": {
8
- "build": "tsc",
9
- "prepublishOnly": "npm run build",
10
8
  "test": "echo \"Error: no test specified\" && exit 1"
11
9
  },
12
10
  "keywords": [
@@ -24,17 +22,7 @@
24
22
  "url": "https://github.com/dpraful/react-native-ui-kit/issues"
25
23
  },
26
24
  "devDependencies": {
27
- "@types/react": "^19.2.14",
28
- "@types/react-native": "^0.72.8",
29
- "typescript": "^5.0.0"
30
- },
31
- "peerDependencies": {
32
25
  "react": "^18.0.0",
33
26
  "react-native": "^0.69.0"
34
- },
35
- "files": [
36
- "dist",
37
- "LICENSE",
38
- "README.md"
39
- ]
40
- }
27
+ }
28
+ }
@@ -0,0 +1,196 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import {
3
+ View,
4
+ Dimensions,
5
+ Text,
6
+ TouchableOpacity,
7
+ StyleSheet,
8
+ Image,
9
+ } from 'react-native';
10
+
11
+ import { Global } from '../../../../../src/Common/Global';
12
+ import Icons from '../Common/Icons';
13
+ import { ValueCheck } from '../CommonStyle/ComponentFunctions';
14
+ import { normalize } from '../CommonStyle/componentStyle';
15
+ import CModalOverlay from '../CustomComponents/CModalOverlay';
16
+
17
+ /**
18
+ * Types
19
+ */
20
+ type AlertData = {
21
+ datavalue: number;
22
+ displaytext?: string;
23
+ bgcolor?: string;
24
+ duration?: number;
25
+ };
26
+
27
+ type Props = {
28
+ data: AlertData;
29
+ close: (value: boolean) => void;
30
+ };
31
+
32
+ const AAlert: React.FC<Props> = (props) => {
33
+ const [overlay, setOverlay] = useState<boolean>(true);
34
+
35
+ const [data] = useState<AlertData & {
36
+ bgcolor: string;
37
+ durartion: number;
38
+ }>({
39
+ ...props.data,
40
+ bgcolor: getBgColor(props.data.datavalue),
41
+ durartion: getDurarion(props.data.datavalue),
42
+ });
43
+
44
+ useEffect(() => {
45
+ const timer = setTimeout(() => {
46
+ props.close(false);
47
+ setOverlay(false);
48
+ }, data.durartion);
49
+
50
+ return () => clearTimeout(timer);
51
+ }, []);
52
+
53
+ function getBgColor(key: number): string {
54
+ switch (key) {
55
+ case 1:
56
+ return '#0ca004';
57
+ case 2:
58
+ return '#f44e4e';
59
+ case 3:
60
+ return '#bfbf18';
61
+ case 4:
62
+ return '#d88304';
63
+ default:
64
+ return Global.AppTheme?.primary_color ?? '#000';
65
+ }
66
+ }
67
+
68
+ function getTransparentColor(key: number): string {
69
+ switch (key) {
70
+ case 1:
71
+ return 'rgba(0, 90, 0, 0.2)';
72
+ case 2:
73
+ return 'rgba(90, 0, 0, 0.2)';
74
+ case 3:
75
+ return 'rgba(249, 242, 172, 0.2)';
76
+ case 4:
77
+ return 'rgba(249, 212, 167, 0.2)';
78
+ default:
79
+ return 'rgba(0, 0, 0, 0.2)';
80
+ }
81
+ }
82
+
83
+ function getDurarion(key: number): number {
84
+ return 2000;
85
+ }
86
+
87
+ function getPopupContainerStyleIOS() {
88
+ return {
89
+ ...styles.overlaystyle,
90
+ backgroundColor: ValueCheck(data.bgcolor) ? data.bgcolor : '#fff',
91
+ bottom: normalize(100),
92
+ };
93
+ }
94
+
95
+ const handleClose = () => {
96
+ setOverlay(false);
97
+ props.close(false);
98
+ };
99
+
100
+ return (
101
+ <CModalOverlay
102
+ visible={overlay}
103
+ onClose={handleClose}
104
+ animationType="fadeInUp"
105
+ animationDuration={500}
106
+ closeOnTouchOutside={false}
107
+ containerStyle={{
108
+ width: '100%',
109
+ backgroundColor: getTransparentColor(data.datavalue),
110
+ }}
111
+ childrenWrapperStyle={getPopupContainerStyleIOS()}
112
+ >
113
+ {/* Close button */}
114
+ <TouchableOpacity
115
+ style={{
116
+ position: 'absolute',
117
+ right: normalize(15),
118
+ zIndex: 1,
119
+ top: normalize(5),
120
+ }}
121
+ onPress={handleClose}
122
+ >
123
+ <Icons.AntDesign
124
+ name="closecircleo"
125
+ size={normalize(15)}
126
+ color="#fff"
127
+ />
128
+ </TouchableOpacity>
129
+
130
+ {/* Content */}
131
+ <View style={{ flexDirection: 'row', width: '100%' }}>
132
+ {/* Icon section */}
133
+ <View
134
+ style={{
135
+ flexDirection: 'row',
136
+ alignItems: 'center',
137
+ justifyContent: 'center',
138
+ }}
139
+ >
140
+ <Image
141
+ style={{
142
+ height: normalize(30),
143
+ width: normalize(30),
144
+ borderRadius: normalize(50),
145
+ }}
146
+ resizeMode="stretch"
147
+ source={require('../../android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png')}
148
+ />
149
+
150
+ <Icons.Entypo
151
+ color="#fff"
152
+ name="info"
153
+ size={normalize(15)}
154
+ />
155
+ </View>
156
+
157
+ {/* Text section */}
158
+ <View
159
+ style={{
160
+ flexDirection: 'row',
161
+ alignItems: 'center',
162
+ justifyContent: 'center',
163
+ flex: 1,
164
+ }}
165
+ >
166
+ <Text
167
+ adjustsFontSizeToFit
168
+ style={{
169
+ color: '#fff',
170
+ fontWeight: 'bold',
171
+ fontSize: normalize(16),
172
+ paddingLeft: normalize(7),
173
+ }}
174
+ >
175
+ {ValueCheck(data.displaytext) ? data.displaytext : ''}
176
+ </Text>
177
+ </View>
178
+ </View>
179
+ </CModalOverlay>
180
+ );
181
+ };
182
+
183
+ export default AAlert;
184
+
185
+ /**
186
+ * Styles
187
+ */
188
+ const styles = StyleSheet.create({
189
+ overlaystyle: {
190
+ position: 'absolute',
191
+ width: Dimensions.get('window').width,
192
+ borderRadius: normalize(30),
193
+ borderWidth: 2,
194
+ borderColor: '#e0e0e0',
195
+ },
196
+ });
@@ -0,0 +1,148 @@
1
+ import React, { useState, useEffect } from 'react';
2
+ import {
3
+ View,
4
+ Dimensions,
5
+ Text,
6
+ Image,
7
+ StyleSheet,
8
+ } from 'react-native';
9
+
10
+ import { Global } from '../../../../../src/Common/Global';
11
+ import Icons from '../Common/Icons';
12
+ import { ValueCheck } from '../CommonStyle/ComponentFunctions';
13
+ import { normalize } from '../CommonStyle/componentStyle';
14
+
15
+ /**
16
+ * Types
17
+ */
18
+ type AlertData = {
19
+ datavalue: number;
20
+ displaytext?: string;
21
+ bgcolor?: string;
22
+ duration?: number;
23
+ };
24
+
25
+ type Props = {
26
+ data: AlertData;
27
+ close: (value: boolean) => void;
28
+ };
29
+
30
+ const AAlertIOS: React.FC<Props> = (props) => {
31
+ const [overlay, setOverlay] = useState<boolean>(true);
32
+
33
+ const [data] = useState<
34
+ AlertData & { bgcolor: string; durartion: number }
35
+ >({
36
+ ...props.data,
37
+ bgcolor: getBgColor(props.data.datavalue),
38
+ durartion: getDurarion(props.data.datavalue),
39
+ });
40
+
41
+ useEffect(() => {
42
+ const timer = setTimeout(() => {
43
+ props.close(false);
44
+ setOverlay(false);
45
+ }, data.durartion);
46
+
47
+ return () => clearTimeout(timer);
48
+ }, []);
49
+
50
+ function getBgColor(key: number): string {
51
+ switch (key) {
52
+ case 1:
53
+ return '#0ca004';
54
+ case 2:
55
+ return '#f44e4e';
56
+ case 3:
57
+ return '#bfbf18';
58
+ case 4:
59
+ return '#d88304';
60
+ default:
61
+ return Global.AppTheme?.primary_color ?? '#000';
62
+ }
63
+ }
64
+
65
+ function getDurarion(key: number): number {
66
+ return 2500;
67
+ }
68
+
69
+ return (
70
+ <View
71
+ style={{
72
+ position: 'absolute',
73
+ bottom: normalize(80),
74
+ zIndex: 1,
75
+ }}
76
+ >
77
+ <View
78
+ style={{
79
+ flexDirection: 'row',
80
+ backgroundColor: data.bgcolor,
81
+ width: Dimensions.get('screen').width,
82
+ paddingHorizontal: normalize(10),
83
+ paddingVertical: normalize(10),
84
+ borderRadius: normalize(10),
85
+ borderWidth: normalize(2),
86
+ borderColor: '#fff',
87
+ }}
88
+ >
89
+ {/* App icon */}
90
+ <Image
91
+ style={{
92
+ height: normalize(30),
93
+ width: normalize(30),
94
+ borderRadius: normalize(50),
95
+ alignSelf: 'flex-start',
96
+ }}
97
+ resizeMode="stretch"
98
+ source={require('../../android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png')}
99
+ />
100
+
101
+ {/* Text content */}
102
+ <View
103
+ style={{
104
+ flexDirection: 'row',
105
+ alignItems: 'center',
106
+ justifyContent: 'center',
107
+ paddingLeft: normalize(15),
108
+ flex: 1,
109
+ }}
110
+ >
111
+ <Icons.Entypo
112
+ color="#fff"
113
+ name="info"
114
+ size={normalize(15)}
115
+ />
116
+
117
+ <Text
118
+ adjustsFontSizeToFit
119
+ style={{
120
+ color: '#fff',
121
+ fontWeight: 'bold',
122
+ fontSize: normalize(16),
123
+ paddingLeft: normalize(7),
124
+ paddingRight: normalize(30),
125
+ }}
126
+ >
127
+ {ValueCheck(data.displaytext) ? data.displaytext : ''}
128
+ </Text>
129
+ </View>
130
+ </View>
131
+ </View>
132
+ );
133
+ };
134
+
135
+ export default AAlertIOS;
136
+
137
+ /**
138
+ * (Optional styles kept for future reuse)
139
+ */
140
+ const styles = StyleSheet.create({
141
+ overlaystyle: {
142
+ position: 'absolute',
143
+ width: Dimensions.get('window').width,
144
+ borderRadius: normalize(15),
145
+ borderWidth: 2,
146
+ borderColor: '#e0e0e0',
147
+ },
148
+ });
@@ -0,0 +1,73 @@
1
+ import React, { ErrorInfo, ReactNode } from 'react';
2
+ import { Button, StyleSheet, Text, View, Image } from 'react-native';
3
+ import { notifyMessage } from '../CommonStyle/ComponentFunctions';
4
+ import { normalize } from '../CommonStyle/componentStyle';
5
+
6
+ interface Props {
7
+ children: ReactNode;
8
+ }
9
+
10
+ interface State {
11
+ hasError: boolean;
12
+ }
13
+
14
+ class ErrorBoundary extends React.Component<Props, State> {
15
+ constructor(props: Props) {
16
+ super(props);
17
+ this.state = { hasError: false };
18
+ }
19
+
20
+ static getDerivedStateFromError(_: Error): State {
21
+ // Update state so the next render will show the fallback UI.
22
+ return { hasError: true };
23
+ }
24
+
25
+ componentDidCatch(error: Error, errorInfo: ErrorInfo) {
26
+ // You can also log the error to an error reporting service
27
+ // console.log('componentDidCatch ', error, ' ', errorInfo);
28
+ notifyMessage("ERROR : " + error + ' ' + errorInfo, 2)
29
+ }
30
+
31
+ render() {
32
+ if (this.state.hasError) {
33
+ // You can render any custom fallback UI
34
+ return (
35
+ <View style={styles.container}>
36
+ <View style={{ width: '100%', }}>
37
+ <Image
38
+ source={{ uri: "https://t4.ftcdn.net/jpg/05/24/04/51/360_F_524045110_UXnCx4GEDapddDi5tdlY96s4g0MxHRvt.jpg" }}
39
+ resizeMode="cover" style={{ height: normalize(200) }} />
40
+ </View>
41
+ <Text style={styles.message}>
42
+ Something went wrong.{'\n'} Our team has taken a note of this issue.
43
+ </Text>
44
+ {/* <Button
45
+ title="Try Again"
46
+ onPress={() => CodePush.restartApp()}
47
+ /> */}
48
+
49
+ </View>
50
+ );
51
+ }
52
+
53
+ return this.props.children;
54
+ }
55
+ }
56
+
57
+ export default ErrorBoundary;
58
+
59
+ const styles = StyleSheet.create({
60
+ container: {
61
+ flex: 1,
62
+ justifyContent: 'center',
63
+ alignItems: 'center',
64
+ backgroundColor: '#fff'
65
+ },
66
+ message: {
67
+ fontSize: normalize(16),
68
+ color: 'black',
69
+ marginBottom: 20,
70
+ textAlign: 'center',
71
+ paddingHorizontal: 10,
72
+ },
73
+ });
@@ -0,0 +1,97 @@
1
+ import React from 'react';
2
+ import MaterialCommunityIconsI from 'react-native-vector-icons/MaterialCommunityIcons';
3
+ import SimpleLineIconsI from 'react-native-vector-icons/SimpleLineIcons';
4
+ import MaterialIconsI from 'react-native-vector-icons/MaterialIcons';
5
+ import FontAwesomeI from 'react-native-vector-icons/FontAwesome';
6
+ import FoundationI from 'react-native-vector-icons/Foundation';
7
+ import EvilIconsI from 'react-native-vector-icons/EvilIcons';
8
+ import OcticonsI from 'react-native-vector-icons/Octicons';
9
+ import IoniconsI from 'react-native-vector-icons/Ionicons';
10
+ import FeatherI from 'react-native-vector-icons/Feather';
11
+ import EntypoI from 'react-native-vector-icons/Entypo';
12
+ import ZocialI from 'react-native-vector-icons/Zocial';
13
+ import FontAwesome5I from 'react-native-vector-icons/FontAwesome5';
14
+ import AntDesignI from 'react-native-vector-icons/AntDesign';
15
+
16
+ import type { IconProps } from 'react-native-vector-icons/Icon';
17
+
18
+ /**
19
+ * Shared icon props type
20
+ */
21
+ type Props = IconProps;
22
+
23
+ /**
24
+ * Wrapper components (typed)
25
+ */
26
+ export const MaterialCommunityIcons: React.FC<Props> = (props) => (
27
+ <MaterialCommunityIconsI {...props} />
28
+ );
29
+
30
+ export const SimpleLineIcons: React.FC<Props> = (props) => (
31
+ <SimpleLineIconsI {...props} />
32
+ );
33
+
34
+ export const MaterialIcons: React.FC<Props> = (props) => (
35
+ <MaterialIconsI {...props} />
36
+ );
37
+
38
+ export const FontAwesome: React.FC<Props> = (props) => (
39
+ <FontAwesomeI {...props} />
40
+ );
41
+
42
+ export const Foundation: React.FC<Props> = (props) => (
43
+ <FoundationI {...props} />
44
+ );
45
+
46
+ export const EvilIcons: React.FC<Props> = (props) => (
47
+ <EvilIconsI {...props} />
48
+ );
49
+
50
+ export const Ionicons: React.FC<Props> = (props) => (
51
+ <IoniconsI {...props} />
52
+ );
53
+
54
+ export const Octicons: React.FC<Props> = (props) => (
55
+ <OcticonsI {...props} />
56
+ );
57
+
58
+ export const Feather: React.FC<Props> = (props) => (
59
+ <FeatherI {...props} />
60
+ );
61
+
62
+ export const Entypo: React.FC<Props> = (props) => (
63
+ <EntypoI {...props} />
64
+ );
65
+
66
+ export const Zocial: React.FC<Props> = (props) => (
67
+ <ZocialI {...props} />
68
+ );
69
+
70
+ export const FontAwesome5: React.FC<Props> = (props) => (
71
+ <FontAwesome5I {...props} />
72
+ );
73
+
74
+ export const AntDesign: React.FC<Props> = (props) => (
75
+ <AntDesignI {...props} />
76
+ );
77
+
78
+ /**
79
+ * Default export object (same usage style as your JS version)
80
+ */
81
+ const Icons = {
82
+ MaterialCommunityIcons,
83
+ SimpleLineIcons,
84
+ MaterialIcons,
85
+ FontAwesome,
86
+ Foundation,
87
+ EvilIcons,
88
+ Ionicons,
89
+ Octicons,
90
+ Feather,
91
+ Entypo,
92
+ Zocial,
93
+ FontAwesome5,
94
+ AntDesign,
95
+ };
96
+
97
+ export default Icons;