@jescon-technologies/react-native-ui-kit 0.0.14 → 0.0.15
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 +9 -6
- package/index.js +9 -6
- package/package.json +1 -1
- package/src/Common/Global.ts +10 -0
- package/src/Common/NetworkServiceCall.ts +1 -1
- package/src/CommonStyle/ComponentFunctions.tsx +1 -23
- package/src/Custom/CSliderMenu.tsx +10 -0
- package/src/Custom/OUserView.tsx +10 -0
- package/src/CustomComponents/CBackHandler.tsx +1 -1
- package/src/CustomComponents/CContainerView.tsx +38 -0
- package/src/CustomComponents/CDetailView.tsx +235 -0
- package/src/CustomComponents/CFooterView.tsx +86 -0
- package/src/CustomComponents/CNetworkStatus.tsx +172 -0
- package/src/CustomComponents/COverlay.tsx +110 -0
- package/src/CustomComponents/HeaderBlock.tsx +772 -0
- package/src/Handlers/NotificationsContext.tsx +7 -0
- package/src/Handlers/ResponseComponentContext.tsx +56 -0
- package/src/Hoc/HDashboard.tsx +1064 -0
- package/src/Hoc/HIcons.tsx +48 -56
- package/src/Hoc/HShadowButton.tsx +101 -0
- package/src/StaticComponents/SDateTimePicker.tsx +503 -0
- package/src/StaticComponents/SSearchBar.tsx +118 -0
- package/src/Custom/Loader.js +0 -182
- package/src/Layout/LoginLayout.tsx +0 -711
- package/src/Screens/ForgotPassword.tsx +0 -342
- package/src/Screens/Login.tsx +0 -331
- package/src/Screens/Splash.tsx +0 -782
package/index.d.ts
CHANGED
|
@@ -4,15 +4,18 @@ 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 HShadowButton } from './src/Hoc/HShadowButton';
|
|
7
8
|
export { default as Navigation } from './src/Navigation/PageNavigation';
|
|
8
|
-
|
|
9
|
+
export { default as SSearchBar } from './src/StaticComponents/SSearchBar';
|
|
10
|
+
export { default as SDateTimePicker } from './src/StaticComponents/SDateTimePicker';
|
|
11
|
+
export { default as CFooterView } from './src/CustomComponents/CFooterView';
|
|
12
|
+
export { default as CDetailView } from './src/CustomComponents/CDetailView';
|
|
13
|
+
export { default as CContainerView } from './src/CustomComponents/CContainerView';
|
|
14
|
+
export { default as HeaderBlock } from './src/CustomComponents/HeaderBlock';
|
|
15
|
+
export { default as HDashboard } from './src/Hoc/HDashboard';
|
|
9
16
|
export { default as NetworkServiceCall } from './src/Common/NetworkServiceCall';
|
|
17
|
+
export { default as useNotifications } from './src/Handlers/NotificationsContext';
|
|
10
18
|
export * from './src/Navigation/useNavigation';
|
|
11
19
|
export { default as CBackHandler } from './src/CustomComponents/CBackHandler';
|
|
12
20
|
export * from './src/CommonStyle/ComponentFunctions';
|
|
13
21
|
export * from './src/CommonStyle/commonStyle';
|
|
14
|
-
export { default as Loader } from './src/Custom/Loader';
|
|
15
|
-
export { default as LoginLayout } from './src/Layout/LoginLayout';
|
|
16
|
-
export { default as Splash } from './src/Screens/Splash';
|
|
17
|
-
export { default as Login } from './src/Screens/Login';
|
|
18
|
-
export { default as ForgotPassword } from './src/Screens/ForgotPassword';
|
package/index.js
CHANGED
|
@@ -4,15 +4,18 @@ 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 HShadowButton } from './src/Hoc/HShadowButton';
|
|
7
8
|
export { default as Navigation } from './src/Navigation/PageNavigation';
|
|
8
|
-
|
|
9
|
+
export { default as SSearchBar } from './src/StaticComponents/SSearchBar';
|
|
10
|
+
export { default as SDateTimePicker } from './src/StaticComponents/SDateTimePicker';
|
|
11
|
+
export { default as CFooterView } from './src/CustomComponents/CFooterView';
|
|
12
|
+
export { default as CDetailView } from './src/CustomComponents/CDetailView';
|
|
13
|
+
export { default as CContainerView } from './src/CustomComponents/CContainerView';
|
|
14
|
+
export { default as HeaderBlock } from './src/CustomComponents/HeaderBlock';
|
|
15
|
+
export { default as HDashboard } from './src/Hoc/HDashboard';
|
|
9
16
|
export { default as NetworkServiceCall } from './src/Common/NetworkServiceCall';
|
|
17
|
+
export { default as useNotifications } from './src/Handlers/NotificationsContext';
|
|
10
18
|
export * from './src/Navigation/useNavigation';
|
|
11
19
|
export { default as CBackHandler } from './src/CustomComponents/CBackHandler';
|
|
12
20
|
export * from './src/CommonStyle/ComponentFunctions';
|
|
13
21
|
export * from './src/CommonStyle/commonStyle';
|
|
14
|
-
export { default as Loader } from './src/Custom/Loader';
|
|
15
|
-
export { default as LoginLayout } from './src/Layout/LoginLayout';
|
|
16
|
-
export { default as Splash } from './src/Screens/Splash';
|
|
17
|
-
export { default as Login } from './src/Screens/Login';
|
|
18
|
-
export { default as ForgotPassword } from './src/Screens/ForgotPassword';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import axios, { Method, AxiosResponse, AxiosError } from 'axios';
|
|
2
2
|
import { isConnected, notifyMessage, ValueCheck } from '../CommonStyle/ComponentFunctions';
|
|
3
|
-
import { Global } from '
|
|
3
|
+
import { Global } from '../Common/Global';
|
|
4
4
|
import { Platform } from 'react-native';
|
|
5
5
|
|
|
6
6
|
// Type definitions
|
|
@@ -16,8 +16,7 @@ import {
|
|
|
16
16
|
ImageStyle,
|
|
17
17
|
} from 'react-native';
|
|
18
18
|
import NetInfo from '@react-native-community/netinfo';
|
|
19
|
-
import { Global } from '
|
|
20
|
-
import { APIURL } from '../../../../../src/Common/apiConstants';
|
|
19
|
+
import { Global } from '../Common/Global';
|
|
21
20
|
import React from 'react';
|
|
22
21
|
|
|
23
22
|
const {
|
|
@@ -99,27 +98,6 @@ export function CShadowDynamic(
|
|
|
99
98
|
};
|
|
100
99
|
}
|
|
101
100
|
|
|
102
|
-
// Loader Components
|
|
103
|
-
export function LoaderIndicator(i?: any): React.JSX.Element {
|
|
104
|
-
return (
|
|
105
|
-
<View style={{
|
|
106
|
-
backgroundColor: '#ffffff',
|
|
107
|
-
padding: normalize(10),
|
|
108
|
-
paddingHorizontal: normalize(20),
|
|
109
|
-
borderRadius: 10,
|
|
110
|
-
alignItems: 'center',
|
|
111
|
-
}}>
|
|
112
|
-
<Image
|
|
113
|
-
style={{
|
|
114
|
-
width: normalize(35),
|
|
115
|
-
height: normalize(35),
|
|
116
|
-
}}
|
|
117
|
-
source={{ uri: `${APIURL}file/getCommonFile/image/heartpulse.gif` }}
|
|
118
|
-
resizeMode={Image.resizeMode.contain}
|
|
119
|
-
/>
|
|
120
|
-
</View>
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
101
|
|
|
124
102
|
export function Loader(): React.JSX.Element {
|
|
125
103
|
return (
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
TextStyle,
|
|
11
11
|
ViewStyle,
|
|
12
12
|
} from 'react-native';
|
|
13
|
-
import { Global } from '
|
|
13
|
+
import { Global } from '../Common/Global';
|
|
14
14
|
import { normalize } from '../CommonStyle/componentStyle';
|
|
15
15
|
import Svg, { Rect, Defs, LinearGradient, Stop } from 'react-native-svg';
|
|
16
16
|
import HIcons from '../Hoc/HIcons';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Platform, StyleSheet, View, ViewStyle } from 'react-native';
|
|
3
|
+
import { Global } from '../Common/Global';
|
|
4
|
+
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
// Types
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
export interface CContainerViewProps {
|
|
10
|
+
children?: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Styles
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* `100vh` is only valid on web (RN-web). On native, `height` must be a number
|
|
19
|
+
* or percentage — so we only apply it when running on web.
|
|
20
|
+
*/
|
|
21
|
+
const styles = StyleSheet.create({
|
|
22
|
+
container: {
|
|
23
|
+
flex: 1,
|
|
24
|
+
flexDirection: 'column',
|
|
25
|
+
backgroundColor: Global.AppTheme.primary_color,
|
|
26
|
+
...(Platform.OS === 'web' ? { height: '100vh' as unknown as ViewStyle['height'] } : {}),
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// ---------------------------------------------------------------------------
|
|
31
|
+
// Component
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
|
|
34
|
+
const CContainerView: React.FC<CContainerViewProps> = ({ children }) => {
|
|
35
|
+
return <View style={styles.container}>{children}</View>;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export default CContainerView;
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
StyleSheet,
|
|
4
|
+
View,
|
|
5
|
+
ImageBackground,
|
|
6
|
+
Platform,
|
|
7
|
+
Dimensions,
|
|
8
|
+
ViewStyle,
|
|
9
|
+
ImageStyle,
|
|
10
|
+
TextStyle,
|
|
11
|
+
} from 'react-native';
|
|
12
|
+
import { Global } from '../Common/Global';
|
|
13
|
+
// import CSwipeCard from '../Components/CSwipeCard';
|
|
14
|
+
import { normalize } from '../CommonStyle/ComponentFunctions';
|
|
15
|
+
import { useNavigation } from '../Navigation/PageNavigation';
|
|
16
|
+
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
// Types
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
|
|
21
|
+
export interface CDetailViewProps {
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
/** Overrides the default white background. */
|
|
24
|
+
backgroundColor?: string;
|
|
25
|
+
/** Remote image URL to display as background. */
|
|
26
|
+
bgimage?: string;
|
|
27
|
+
/** Hides the CSwipeCard header when true. */
|
|
28
|
+
hideCard?: boolean;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
interface UserOption {
|
|
32
|
+
suoption?: number;
|
|
33
|
+
optiondetail?: Array<{
|
|
34
|
+
suoptiondetail?: number;
|
|
35
|
+
component?: string;
|
|
36
|
+
[key: string]: unknown;
|
|
37
|
+
}>;
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
interface PatientDetails {
|
|
42
|
+
EditStatus?: boolean;
|
|
43
|
+
suavailability?: number;
|
|
44
|
+
type?: string | number;
|
|
45
|
+
keycode?: string | number;
|
|
46
|
+
[key: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
interface SwipeValue {
|
|
50
|
+
keyid?: string | number;
|
|
51
|
+
functionid?: string | number;
|
|
52
|
+
row?: string | number;
|
|
53
|
+
[key: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// ---------------------------------------------------------------------------
|
|
57
|
+
// Styles (static — dynamic backgroundColor is applied at usage site)
|
|
58
|
+
// ---------------------------------------------------------------------------
|
|
59
|
+
|
|
60
|
+
const styles = StyleSheet.create({
|
|
61
|
+
CDetailView: {
|
|
62
|
+
flex: 1,
|
|
63
|
+
shadowColor: '#000',
|
|
64
|
+
shadowOffset: { width: 0, height: 2 },
|
|
65
|
+
shadowOpacity: 0.8,
|
|
66
|
+
shadowRadius: 2,
|
|
67
|
+
borderTopLeftRadius: 20,
|
|
68
|
+
borderTopRightRadius: 20,
|
|
69
|
+
width: '100%',
|
|
70
|
+
} as ViewStyle,
|
|
71
|
+
image: {
|
|
72
|
+
flex: 1,
|
|
73
|
+
width: Platform.OS === 'web' ? '88%' : '100%',
|
|
74
|
+
alignSelf: 'center',
|
|
75
|
+
} as ViewStyle,
|
|
76
|
+
productHeaderCard: {
|
|
77
|
+
flexDirection: 'row',
|
|
78
|
+
alignItems: 'center',
|
|
79
|
+
paddingVertical: 2,
|
|
80
|
+
} as ViewStyle,
|
|
81
|
+
productImageContainer: {
|
|
82
|
+
width: normalize(50),
|
|
83
|
+
height: normalize(50),
|
|
84
|
+
borderRadius: 8,
|
|
85
|
+
backgroundColor: '#f8f9fa',
|
|
86
|
+
justifyContent: 'center',
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
borderWidth: 1,
|
|
89
|
+
borderColor: Global.AppTheme.primary_color + '40',
|
|
90
|
+
borderStyle: 'dashed',
|
|
91
|
+
overflow: 'hidden',
|
|
92
|
+
} as ViewStyle,
|
|
93
|
+
productImage: {
|
|
94
|
+
width: '100%',
|
|
95
|
+
height: '100%',
|
|
96
|
+
borderRadius: 6,
|
|
97
|
+
} as ImageStyle,
|
|
98
|
+
imagePlaceholder: {
|
|
99
|
+
justifyContent: 'center',
|
|
100
|
+
alignItems: 'center',
|
|
101
|
+
} as ViewStyle,
|
|
102
|
+
imageAddText: {
|
|
103
|
+
fontSize: normalize(6),
|
|
104
|
+
fontWeight: '700',
|
|
105
|
+
color: Global.AppTheme.primary_color,
|
|
106
|
+
marginTop: normalize(2),
|
|
107
|
+
} as TextStyle,
|
|
108
|
+
productInfoSection: {
|
|
109
|
+
flex: 1,
|
|
110
|
+
marginLeft: normalize(8),
|
|
111
|
+
justifyContent: 'center',
|
|
112
|
+
} as ViewStyle,
|
|
113
|
+
productMainTitle: {
|
|
114
|
+
fontSize: normalize(13),
|
|
115
|
+
fontWeight: '700',
|
|
116
|
+
color: '#1a1a2e',
|
|
117
|
+
marginBottom: 2,
|
|
118
|
+
lineHeight: normalize(16),
|
|
119
|
+
} as TextStyle,
|
|
120
|
+
productMetaRow: {
|
|
121
|
+
flexDirection: 'row',
|
|
122
|
+
alignItems: 'center',
|
|
123
|
+
marginBottom: 1,
|
|
124
|
+
} as ViewStyle,
|
|
125
|
+
productMetaText: {
|
|
126
|
+
fontSize: normalize(10),
|
|
127
|
+
color: '#64748b',
|
|
128
|
+
marginLeft: normalize(4),
|
|
129
|
+
flex: 1,
|
|
130
|
+
fontWeight: '500',
|
|
131
|
+
} as TextStyle,
|
|
132
|
+
actionButton: {
|
|
133
|
+
borderRadius: 8,
|
|
134
|
+
borderWidth: 0.5,
|
|
135
|
+
height:
|
|
136
|
+
Platform.OS !== 'web'
|
|
137
|
+
? Dimensions.get('screen').height * 0.04
|
|
138
|
+
: Dimensions.get('screen').height * 0.06,
|
|
139
|
+
width: Dimensions.get('screen').width * 0.06,
|
|
140
|
+
backgroundColor: '#fff',
|
|
141
|
+
justifyContent: 'center',
|
|
142
|
+
alignItems: 'center',
|
|
143
|
+
marginHorizontal: '1%',
|
|
144
|
+
borderColor: Global.AppTheme.primary_color,
|
|
145
|
+
} as ViewStyle,
|
|
146
|
+
optionText: {
|
|
147
|
+
fontSize: normalize(8),
|
|
148
|
+
fontWeight: 'bold',
|
|
149
|
+
color: Global.AppTheme.primary_color,
|
|
150
|
+
textAlign: 'center',
|
|
151
|
+
} as TextStyle,
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
// ---------------------------------------------------------------------------
|
|
155
|
+
// Component
|
|
156
|
+
// ---------------------------------------------------------------------------
|
|
157
|
+
|
|
158
|
+
const CDetailView: React.FC<CDetailViewProps> = ({
|
|
159
|
+
children,
|
|
160
|
+
backgroundColor,
|
|
161
|
+
bgimage,
|
|
162
|
+
hideCard,
|
|
163
|
+
}) => {
|
|
164
|
+
const navigation = useNavigation();
|
|
165
|
+
|
|
166
|
+
const handleSwipeCallback = (val: SwipeValue, item: PatientDetails): void => {
|
|
167
|
+
Global.PatientDetails = item;
|
|
168
|
+
|
|
169
|
+
const productSection = (Global.userOptionList as UserOption[] | undefined)?.find(
|
|
170
|
+
(section) => section.suoption === 31900
|
|
171
|
+
);
|
|
172
|
+
const filteredDetails = productSection?.optiondetail?.filter(
|
|
173
|
+
(option) => option.suoptiondetail === val.keyid
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
console.log('Swipe Callback Value:', JSON.stringify(val));
|
|
177
|
+
console.log('Filtered Details', JSON.stringify(filteredDetails));
|
|
178
|
+
|
|
179
|
+
// NOTE: `val.functionid || val.row` is compared to string cases 'L'/'R'.
|
|
180
|
+
// If the API ever returns numeric row (e.g. 1), this will always fall to
|
|
181
|
+
// `default`. Consider coercing: `String(val.functionid ?? val.row)`.
|
|
182
|
+
switch (val.functionid || val.row) {
|
|
183
|
+
case 'L':
|
|
184
|
+
navigation.navigate('WrappedComponent', {
|
|
185
|
+
component: filteredDetails?.[0]?.component,
|
|
186
|
+
data: filteredDetails?.[0],
|
|
187
|
+
itemdata: item,
|
|
188
|
+
});
|
|
189
|
+
break;
|
|
190
|
+
case 'R':
|
|
191
|
+
navigation.navigate('DetailsOverlay', { data: item, code: val });
|
|
192
|
+
break;
|
|
193
|
+
default:
|
|
194
|
+
console.log('Not Available', JSON.stringify(val));
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
const patient = Global.PatientDetails as PatientDetails | null | undefined;
|
|
199
|
+
const userData = Global.userData as { suuser?: number } | null | undefined;
|
|
200
|
+
|
|
201
|
+
return (
|
|
202
|
+
<View
|
|
203
|
+
style={[
|
|
204
|
+
styles.CDetailView,
|
|
205
|
+
{ backgroundColor: backgroundColor ?? 'white' },
|
|
206
|
+
]}
|
|
207
|
+
>
|
|
208
|
+
<ImageBackground
|
|
209
|
+
source={
|
|
210
|
+
bgimage != undefined
|
|
211
|
+
? { uri: bgimage }
|
|
212
|
+
: null
|
|
213
|
+
}
|
|
214
|
+
resizeMode={bgimage != undefined ? 'stretch' : 'contain'}
|
|
215
|
+
imageStyle={bgimage != undefined ? { opacity: 1 } : { opacity: 0.1 }}
|
|
216
|
+
style={styles.image}
|
|
217
|
+
>
|
|
218
|
+
{/* {patient != null && !hideCard ? (
|
|
219
|
+
<CSwipeCard
|
|
220
|
+
edited={patient?.EditStatus}
|
|
221
|
+
availability={patient?.suavailability}
|
|
222
|
+
data={patient}
|
|
223
|
+
style={Global?.optiondata}
|
|
224
|
+
rightButtonsapi={`${APIURL}invget/invcommonget/rnproductdescription ${userData?.suuser},${patient?.type},${patient?.keycode}`}
|
|
225
|
+
leftButtonsapi={`${APIURL}invget/invcommonget/rninsuproductdescription ${patient?.keycode},${userData?.suuser}`}
|
|
226
|
+
callback={(val: SwipeValue) => handleSwipeCallback(val, patient)}
|
|
227
|
+
/>
|
|
228
|
+
) : null} */}
|
|
229
|
+
{children}
|
|
230
|
+
</ImageBackground>
|
|
231
|
+
</View>
|
|
232
|
+
);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
export default CDetailView;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Dimensions,
|
|
4
|
+
Platform,
|
|
5
|
+
View,
|
|
6
|
+
ScrollView,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
StyleProp,
|
|
9
|
+
ViewStyle,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
|
|
12
|
+
// ---------------------------------------------------------------------------
|
|
13
|
+
// Types
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
|
|
16
|
+
export interface CFooterViewProps {
|
|
17
|
+
/** Extra style merged onto the outer container. */
|
|
18
|
+
style?: StyleProp<ViewStyle>;
|
|
19
|
+
/** Footer content (usually a row of buttons / icons). */
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
// Styles
|
|
25
|
+
// ---------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
const styles = StyleSheet.create({
|
|
28
|
+
base: {
|
|
29
|
+
backgroundColor: 'white',
|
|
30
|
+
},
|
|
31
|
+
content: {
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
},
|
|
34
|
+
webContent: {
|
|
35
|
+
flexDirection: 'column',
|
|
36
|
+
paddingVertical: '1%',
|
|
37
|
+
},
|
|
38
|
+
mobileContent: {
|
|
39
|
+
flexDirection: 'row',
|
|
40
|
+
paddingHorizontal: '1%',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// Component
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
|
|
48
|
+
const CFooterView: React.FC<CFooterViewProps> = ({ style, children }) => {
|
|
49
|
+
const isWeb = Platform.OS === 'web';
|
|
50
|
+
|
|
51
|
+
const containerStyle: ViewStyle = isWeb
|
|
52
|
+
? {
|
|
53
|
+
position: 'absolute',
|
|
54
|
+
right: 0,
|
|
55
|
+
bottom: 0,
|
|
56
|
+
width: 80,
|
|
57
|
+
borderLeftWidth: 1,
|
|
58
|
+
borderLeftColor: 'lightgrey',
|
|
59
|
+
zIndex: 10,
|
|
60
|
+
elevation: 10,
|
|
61
|
+
maxHeight: '90%',
|
|
62
|
+
}
|
|
63
|
+
: {
|
|
64
|
+
borderTopWidth: 1,
|
|
65
|
+
borderTopColor: 'lightgrey',
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<View style={[styles.base, containerStyle, style]}>
|
|
70
|
+
<ScrollView
|
|
71
|
+
horizontal={!isWeb}
|
|
72
|
+
showsHorizontalScrollIndicator={false}
|
|
73
|
+
showsVerticalScrollIndicator={false}
|
|
74
|
+
bounces={false}
|
|
75
|
+
contentContainerStyle={[
|
|
76
|
+
styles.content,
|
|
77
|
+
isWeb ? styles.webContent : styles.mobileContent,
|
|
78
|
+
]}
|
|
79
|
+
>
|
|
80
|
+
{children}
|
|
81
|
+
</ScrollView>
|
|
82
|
+
</View>
|
|
83
|
+
);
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export default CFooterView;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import NetInfo, { NetInfoState, NetInfoStateType } from '@react-native-community/netinfo';
|
|
4
|
+
import { normalize } from '../CommonStyle/componentStyle';
|
|
5
|
+
import HIcons from '../Hoc/HIcons';
|
|
6
|
+
import ABlink from '../Alerts/ABlink';
|
|
7
|
+
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Types
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
interface NetworkInfo {
|
|
13
|
+
isConnected?: boolean | null;
|
|
14
|
+
isInternetReachable?: boolean | null;
|
|
15
|
+
connectionType?: NetInfoStateType;
|
|
16
|
+
effectiveType?: string | null;
|
|
17
|
+
isExpensive?: boolean | null;
|
|
18
|
+
details?: unknown;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Component
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
|
|
25
|
+
const CNetworkStatus: React.FC = () => {
|
|
26
|
+
const [networkInfo, setNetworkInfo] = useState<NetworkInfo>({});
|
|
27
|
+
|
|
28
|
+
useEffect(() => {
|
|
29
|
+
const unsubscribe = NetInfo.addEventListener((state: NetInfoState) => {
|
|
30
|
+
setNetworkInfo({
|
|
31
|
+
isConnected: state.isConnected,
|
|
32
|
+
isInternetReachable: state.isInternetReachable,
|
|
33
|
+
connectionType: state.type,
|
|
34
|
+
effectiveType: state.type, // state has no `effectiveType`; kept as-is to match original mapping intent
|
|
35
|
+
isExpensive: state.isExpensive,
|
|
36
|
+
details: state.details,
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
return () => unsubscribe();
|
|
41
|
+
}, []);
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Renders a labeled icon.
|
|
45
|
+
* NOTE: currently unused — all `IconButton(...)` call sites are commented out.
|
|
46
|
+
*/
|
|
47
|
+
const IconButton = (
|
|
48
|
+
icongroup: number,
|
|
49
|
+
iconname: string,
|
|
50
|
+
text: string
|
|
51
|
+
): React.ReactElement => (
|
|
52
|
+
<View style={{ justifyContent: 'center', alignItems: 'center' }}>
|
|
53
|
+
<HIcons.Icons
|
|
54
|
+
icongroup={icongroup}
|
|
55
|
+
name={iconname}
|
|
56
|
+
size={normalize(15)}
|
|
57
|
+
color={'white'}
|
|
58
|
+
style={{
|
|
59
|
+
textShadowColor: '#ffffff',
|
|
60
|
+
textShadowOffset: { width: 1, height: 1 },
|
|
61
|
+
textShadowRadius: 1,
|
|
62
|
+
}}
|
|
63
|
+
/>
|
|
64
|
+
<Text
|
|
65
|
+
style={{
|
|
66
|
+
color: 'white',
|
|
67
|
+
fontSize: normalize(7),
|
|
68
|
+
textShadowColor: '#ffffff',
|
|
69
|
+
textShadowOffset: { width: 0.5, height: 0.5 },
|
|
70
|
+
textShadowRadius: 0.5,
|
|
71
|
+
textAlign: 'center',
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
{text}
|
|
75
|
+
</Text>
|
|
76
|
+
</View>
|
|
77
|
+
);
|
|
78
|
+
|
|
79
|
+
const NetWorkIcons = (): React.ReactElement => {
|
|
80
|
+
if (networkInfo.isConnected) {
|
|
81
|
+
// All connected branches return an empty <View /> — the "connected"
|
|
82
|
+
// indicator is intentionally suppressed (see commented blocks above).
|
|
83
|
+
if (networkInfo.connectionType === 'cellular') {
|
|
84
|
+
if (networkInfo.isInternetReachable) {
|
|
85
|
+
return <View />;
|
|
86
|
+
}
|
|
87
|
+
return <View />;
|
|
88
|
+
}
|
|
89
|
+
if (networkInfo.connectionType === 'wifi') {
|
|
90
|
+
if (networkInfo.isInternetReachable) {
|
|
91
|
+
return <View />;
|
|
92
|
+
}
|
|
93
|
+
return <View />;
|
|
94
|
+
}
|
|
95
|
+
return <View />;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<ABlink>
|
|
100
|
+
<View
|
|
101
|
+
style={{
|
|
102
|
+
justifyContent: 'center',
|
|
103
|
+
alignItems: 'center',
|
|
104
|
+
backgroundColor: 'white',
|
|
105
|
+
borderRadius: 10,
|
|
106
|
+
padding: normalize(4),
|
|
107
|
+
}}
|
|
108
|
+
>
|
|
109
|
+
<View style={{ flexDirection: 'row' }}>
|
|
110
|
+
<HIcons.Icons
|
|
111
|
+
icongroup={3}
|
|
112
|
+
name={'wifi-off'}
|
|
113
|
+
size={normalize(20)}
|
|
114
|
+
color={'red'}
|
|
115
|
+
style={{
|
|
116
|
+
textShadowColor: '#ffffff',
|
|
117
|
+
textShadowOffset: { width: 1, height: 1 },
|
|
118
|
+
textShadowRadius: 1,
|
|
119
|
+
}}
|
|
120
|
+
/>
|
|
121
|
+
<HIcons.Icons
|
|
122
|
+
icongroup={3}
|
|
123
|
+
name={'signal-off'}
|
|
124
|
+
size={normalize(20)}
|
|
125
|
+
color={'red'}
|
|
126
|
+
style={{
|
|
127
|
+
textShadowColor: '#ffffff',
|
|
128
|
+
textShadowOffset: { width: 1, height: 1 },
|
|
129
|
+
textShadowRadius: 1,
|
|
130
|
+
}}
|
|
131
|
+
/>
|
|
132
|
+
</View>
|
|
133
|
+
<Text
|
|
134
|
+
style={{
|
|
135
|
+
color: 'red',
|
|
136
|
+
fontSize: normalize(9),
|
|
137
|
+
textShadowColor: '#ffffff',
|
|
138
|
+
textShadowOffset: { width: 0.5, height: 0.5 },
|
|
139
|
+
textShadowRadius: 0.5,
|
|
140
|
+
}}
|
|
141
|
+
>
|
|
142
|
+
NO NETWORK
|
|
143
|
+
</Text>
|
|
144
|
+
</View>
|
|
145
|
+
</ABlink>
|
|
146
|
+
);
|
|
147
|
+
};
|
|
148
|
+
|
|
149
|
+
return (
|
|
150
|
+
<View style={{ flexDirection: 'row' }}>
|
|
151
|
+
{NetWorkIcons()}
|
|
152
|
+
</View>
|
|
153
|
+
);
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
// ---------------------------------------------------------------------------
|
|
157
|
+
// Styles (kept for parity; currently unused by the active component)
|
|
158
|
+
// ---------------------------------------------------------------------------
|
|
159
|
+
|
|
160
|
+
const styles = StyleSheet.create({
|
|
161
|
+
container: {},
|
|
162
|
+
title: {
|
|
163
|
+
fontSize: 24,
|
|
164
|
+
fontWeight: 'bold',
|
|
165
|
+
marginBottom: 20,
|
|
166
|
+
},
|
|
167
|
+
infoText: {
|
|
168
|
+
fontSize: 16,
|
|
169
|
+
},
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
export default CNetworkStatus;
|