react-native-timacare 3.1.38 → 3.1.40
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/lib/commonjs/navigation/primary-navigator.js +1 -1
- package/lib/commonjs/navigation/primary-navigator.js.flow +6 -0
- package/lib/commonjs/navigation/primary-navigator.js.map +1 -1
- package/lib/commonjs/screens/camera/CCCDCameraScreen.js +2 -0
- package/lib/commonjs/screens/camera/CCCDCameraScreen.js.flow +273 -0
- package/lib/commonjs/screens/camera/CCCDCameraScreen.js.map +1 -0
- package/lib/commonjs/screens/camera/index.js +1 -1
- package/lib/commonjs/screens/camera/index.js.flow +59 -78
- package/lib/commonjs/screens/camera/index.js.map +1 -1
- package/lib/commonjs/screens/home/index.js +1 -1
- package/lib/commonjs/screens/home/index.js.flow +2078 -2132
- package/lib/commonjs/screens/home/index.js.map +1 -1
- package/lib/commonjs/screens/nationalID/index.js +1 -1
- package/lib/commonjs/screens/nationalID/index.js.flow +25 -45
- package/lib/commonjs/screens/nationalID/index.js.map +1 -1
- package/lib/commonjs/screens/nationalIDBack/index.js +1 -1
- package/lib/commonjs/screens/nationalIDBack/index.js.flow +24 -45
- package/lib/commonjs/screens/nationalIDBack/index.js.map +1 -1
- package/lib/commonjs/screens/register/index.js +1 -1
- package/lib/commonjs/screens/register/index.js.flow +1 -1
- package/lib/commonjs/screens/schedule-payment/DigitalSchedulePayment.js +1 -1
- package/lib/commonjs/screens/schedule-payment/DigitalSchedulePayment.js.flow +1 -1
- package/lib/commonjs/screens/schedule-payment/DigitalSchedulePayment.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js.flow +0 -1
- package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js.map +1 -1
- package/lib/commonjs/services/api/api-config.js +1 -1
- package/lib/commonjs/services/api/api-config.js.flow +1 -1
- package/lib/commonjs/services/api/api-config.js.map +1 -1
- package/lib/module/navigation/primary-navigator.js +1 -1
- package/lib/module/navigation/primary-navigator.js.map +1 -1
- package/lib/module/screens/camera/CCCDCameraScreen.js +2 -0
- package/lib/module/screens/camera/CCCDCameraScreen.js.map +1 -0
- package/lib/module/screens/camera/index.js +1 -1
- package/lib/module/screens/camera/index.js.map +1 -1
- package/lib/module/screens/home/index.js +1 -1
- package/lib/module/screens/home/index.js.map +1 -1
- package/lib/module/screens/nationalID/index.js +1 -1
- package/lib/module/screens/nationalID/index.js.map +1 -1
- package/lib/module/screens/nationalIDBack/index.js +1 -1
- package/lib/module/screens/nationalIDBack/index.js.map +1 -1
- package/lib/module/screens/register/index.js +1 -1
- package/lib/module/screens/schedule-payment/DigitalSchedulePayment.js +1 -1
- package/lib/module/screens/schedule-payment/DigitalSchedulePayment.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/RegisterCamera.js +1 -1
- package/lib/module/screens/toan-trinh-so/RegisterCamera.js.map +1 -1
- package/lib/module/services/api/api-config.js +1 -1
- package/lib/module/services/api/api-config.js.map +1 -1
- package/lib/typescript/navigation/primary-navigator.d.ts +1 -0
- package/lib/typescript/navigation/primary-navigator.d.ts.map +1 -1
- package/lib/typescript/screens/camera/CCCDCameraScreen.d.ts +2 -0
- package/lib/typescript/screens/camera/CCCDCameraScreen.d.ts.map +1 -0
- package/lib/typescript/screens/camera/index.d.ts.map +1 -1
- package/lib/typescript/screens/home/index.d.ts.map +1 -1
- package/lib/typescript/screens/nationalID/index.d.ts.map +1 -1
- package/lib/typescript/screens/nationalIDBack/index.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/RegisterCamera.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/navigation/primary-navigator.tsx +6 -0
- package/src/screens/camera/CCCDCameraScreen.tsx +273 -0
- package/src/screens/camera/index.tsx +59 -78
- package/src/screens/home/index.tsx +2078 -2132
- package/src/screens/nationalID/index.tsx +25 -45
- package/src/screens/nationalIDBack/index.tsx +24 -45
- package/src/screens/register/index.tsx +1 -1
- package/src/screens/schedule-payment/DigitalSchedulePayment.tsx +1 -1
- package/src/screens/toan-trinh-so/RegisterCamera.tsx +0 -1
- package/src/services/api/api-config.ts +1 -1
|
@@ -10,13 +10,16 @@ import {
|
|
|
10
10
|
Platform,
|
|
11
11
|
SafeAreaView,
|
|
12
12
|
ScrollView,
|
|
13
|
-
StyleSheet,
|
|
14
13
|
TextStyle,
|
|
15
14
|
TouchableOpacity,
|
|
16
15
|
View,
|
|
17
16
|
ViewStyle,
|
|
18
17
|
} from 'react-native';
|
|
19
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
CommonActions,
|
|
20
|
+
useNavigation,
|
|
21
|
+
useIsFocused,
|
|
22
|
+
} from '@react-navigation/native';
|
|
20
23
|
import { observer } from 'mobx-react-lite';
|
|
21
24
|
import { commonStyles } from '../CommonStyles';
|
|
22
25
|
import MButton from '../../components/MButton';
|
|
@@ -46,15 +49,11 @@ import { MText } from '../../components/MText';
|
|
|
46
49
|
import Modal from 'react-native-modal';
|
|
47
50
|
import LinearGradient from 'react-native-linear-gradient';
|
|
48
51
|
|
|
49
|
-
const screenWidth = Dimensions.get('window').width;
|
|
50
|
-
const screenHeight = Dimensions.get('window').height;
|
|
51
|
-
|
|
52
|
-
const frameWidth = screenWidth * 0.85;
|
|
53
|
-
const frameHeight = screenWidth * 0.54;
|
|
54
|
-
|
|
55
52
|
const cameraStore = new Store();
|
|
56
53
|
export const Camera = observer(function Camera(props: any) {
|
|
57
54
|
const navigation = useNavigation();
|
|
55
|
+
const isFocused = useIsFocused();
|
|
56
|
+
const [shouldRenderCamera, setShouldRenderCamera] = useState(false);
|
|
58
57
|
const [passPermission, setPassPermission] = useState(false);
|
|
59
58
|
const [flash, setFlash] = useState(false);
|
|
60
59
|
const [front, setFront] = useState(props.route.params.front);
|
|
@@ -67,14 +66,17 @@ export const Camera = observer(function Camera(props: any) {
|
|
|
67
66
|
const takePhoto = async () => {
|
|
68
67
|
setTaking(true);
|
|
69
68
|
const options = {
|
|
69
|
+
width: 720,
|
|
70
70
|
base64: true,
|
|
71
|
+
pauseAfterCapture: true,
|
|
71
72
|
fixOrientation: false,
|
|
72
73
|
forceUpOrientation: false,
|
|
73
74
|
orientation: RNCamera.Constants.Orientation.portrait,
|
|
74
|
-
skipProcessing: true,
|
|
75
75
|
};
|
|
76
76
|
const data = await myCamera.current.takePictureAsync(options);
|
|
77
|
+
|
|
77
78
|
setTaking(false);
|
|
79
|
+
// eslint-disable-next-line
|
|
78
80
|
navigation.goBack();
|
|
79
81
|
if (props.route.params.callback) {
|
|
80
82
|
props.route.params.callback(data.uri);
|
|
@@ -189,12 +191,26 @@ export const Camera = observer(function Camera(props: any) {
|
|
|
189
191
|
}
|
|
190
192
|
};
|
|
191
193
|
|
|
194
|
+
useEffect(() => {
|
|
195
|
+
let timeout: NodeJS.Timeout;
|
|
196
|
+
if (isFocused) {
|
|
197
|
+
// Delay mounting camera to give Android time to release the previous one
|
|
198
|
+
timeout = setTimeout(() => {
|
|
199
|
+
setShouldRenderCamera(true);
|
|
200
|
+
}, 500); // thử 300ms–500ms nếu cần
|
|
201
|
+
} else {
|
|
202
|
+
setShouldRenderCamera(false);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return () => clearTimeout(timeout);
|
|
206
|
+
}, [isFocused]);
|
|
207
|
+
|
|
192
208
|
return (
|
|
193
209
|
<View
|
|
194
210
|
style={[commonStyles.fill, { backgroundColor: 'black' }]}
|
|
195
211
|
pointerEvents={'box-none'}
|
|
196
212
|
>
|
|
197
|
-
{passPermission && (
|
|
213
|
+
{passPermission && shouldRenderCamera && (
|
|
198
214
|
<View
|
|
199
215
|
style={[
|
|
200
216
|
commonStyles.alignCenter,
|
|
@@ -210,15 +226,12 @@ export const Camera = observer(function Camera(props: any) {
|
|
|
210
226
|
<RNCamera
|
|
211
227
|
ref={myCamera}
|
|
212
228
|
defaultVideoQuality={RNCamera.Constants.VideoQuality['720p']}
|
|
213
|
-
style={
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
height: (Dimensions.get('window').width * 4) / 3.1,
|
|
218
|
-
}
|
|
219
|
-
: StyleSheet.absoluteFillObject
|
|
220
|
-
}
|
|
229
|
+
style={{
|
|
230
|
+
width: Dimensions.get('window').width,
|
|
231
|
+
height: (Dimensions.get('window').width * 4) / 3.1,
|
|
232
|
+
}}
|
|
221
233
|
maxZoom={1}
|
|
234
|
+
zoom={props.route.params.selfie ? 0 : 0.005}
|
|
222
235
|
type={
|
|
223
236
|
front
|
|
224
237
|
? RNCamera.Constants.Type.front
|
|
@@ -229,64 +242,22 @@ export const Camera = observer(function Camera(props: any) {
|
|
|
229
242
|
? RNCamera.Constants.FlashMode.on
|
|
230
243
|
: RNCamera.Constants.FlashMode.off
|
|
231
244
|
}
|
|
245
|
+
androidCameraPermissionOptions={{
|
|
246
|
+
title: 'Permission to use camera',
|
|
247
|
+
message: 'We need your permission to use your camera',
|
|
248
|
+
buttonPositive: 'Ok',
|
|
249
|
+
buttonNegative: 'Cancel',
|
|
250
|
+
}}
|
|
251
|
+
androidRecordAudioPermissionOptions={{
|
|
252
|
+
title: 'Permission to use audio recording',
|
|
253
|
+
message: 'We need your permission to use your audio',
|
|
254
|
+
buttonPositive: 'Ok',
|
|
255
|
+
buttonNegative: 'Cancel',
|
|
256
|
+
}}
|
|
232
257
|
>
|
|
233
258
|
{({ camera, status, recordAudioPermissionStatus }) => {
|
|
234
259
|
if (status !== 'READY') return <ActivityIndicator />;
|
|
235
260
|
}}
|
|
236
|
-
{!props.route.params.selfie && (
|
|
237
|
-
<View
|
|
238
|
-
style={{
|
|
239
|
-
...StyleSheet.absoluteFillObject,
|
|
240
|
-
justifyContent: 'center',
|
|
241
|
-
alignItems: 'center',
|
|
242
|
-
}}
|
|
243
|
-
>
|
|
244
|
-
<View
|
|
245
|
-
style={{
|
|
246
|
-
width: '100%',
|
|
247
|
-
height: (screenHeight - frameHeight) / 2,
|
|
248
|
-
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
249
|
-
}}
|
|
250
|
-
/>
|
|
251
|
-
<View
|
|
252
|
-
style={{
|
|
253
|
-
flexDirection: 'row',
|
|
254
|
-
alignItems: 'center',
|
|
255
|
-
}}
|
|
256
|
-
>
|
|
257
|
-
<View
|
|
258
|
-
style={{
|
|
259
|
-
width: (screenWidth - frameWidth) / 2,
|
|
260
|
-
height: frameHeight,
|
|
261
|
-
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
262
|
-
}}
|
|
263
|
-
/>
|
|
264
|
-
<View
|
|
265
|
-
style={{
|
|
266
|
-
width: frameWidth,
|
|
267
|
-
height: frameHeight,
|
|
268
|
-
borderColor: '#FDFDFD',
|
|
269
|
-
borderWidth: 2,
|
|
270
|
-
borderRadius: 6,
|
|
271
|
-
}}
|
|
272
|
-
/>
|
|
273
|
-
<View
|
|
274
|
-
style={{
|
|
275
|
-
width: (screenWidth - frameWidth) / 2,
|
|
276
|
-
height: frameHeight,
|
|
277
|
-
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
278
|
-
}}
|
|
279
|
-
/>
|
|
280
|
-
</View>
|
|
281
|
-
<View
|
|
282
|
-
style={{
|
|
283
|
-
width: '100%',
|
|
284
|
-
height: (screenHeight - frameHeight) / 2,
|
|
285
|
-
backgroundColor: 'rgba(0, 0, 0, 0.6)',
|
|
286
|
-
}}
|
|
287
|
-
/>
|
|
288
|
-
</View>
|
|
289
|
-
)}
|
|
290
261
|
</RNCamera>
|
|
291
262
|
</View>
|
|
292
263
|
)}
|
|
@@ -331,7 +302,7 @@ export const Camera = observer(function Camera(props: any) {
|
|
|
331
302
|
{
|
|
332
303
|
color: 'white',
|
|
333
304
|
textAlign: 'center',
|
|
334
|
-
|
|
305
|
+
backgroundColor: '#00000099',
|
|
335
306
|
paddingVertical: 12,
|
|
336
307
|
},
|
|
337
308
|
]}
|
|
@@ -356,7 +327,21 @@ export const Camera = observer(function Camera(props: any) {
|
|
|
356
327
|
sáng đủ rõ nét khuôn mặt
|
|
357
328
|
</MText>
|
|
358
329
|
)}
|
|
359
|
-
|
|
330
|
+
{/* {(Platform.OS === 'ios' ? false : !cameraStore.isFace) && selfie && (
|
|
331
|
+
<MText
|
|
332
|
+
style={[
|
|
333
|
+
commonStyles.textNormal,
|
|
334
|
+
{
|
|
335
|
+
color: 'white',
|
|
336
|
+
textAlign: 'center',
|
|
337
|
+
backgroundColor: '#00000099',
|
|
338
|
+
paddingVertical: 12,
|
|
339
|
+
},
|
|
340
|
+
]}
|
|
341
|
+
>
|
|
342
|
+
Vui lòng hướng khuôn mặt vào máy ảnh
|
|
343
|
+
</MText>
|
|
344
|
+
)} */}
|
|
360
345
|
{taking ? (
|
|
361
346
|
<View
|
|
362
347
|
style={[
|
|
@@ -374,10 +359,6 @@ export const Camera = observer(function Camera(props: any) {
|
|
|
374
359
|
commonStyles.alignCenter,
|
|
375
360
|
commonStyles.justifyCenter,
|
|
376
361
|
{
|
|
377
|
-
flex: 0,
|
|
378
|
-
|
|
379
|
-
paddingHorizontal: 20,
|
|
380
|
-
alignSelf: 'center',
|
|
381
362
|
margin: 24,
|
|
382
363
|
},
|
|
383
364
|
]}
|