react-native-timacare 3.3.11 → 3.3.13
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/RNTimacare.js +1 -1
- package/lib/commonjs/RNTimacare.js.flow +2 -11
- package/lib/commonjs/RNTimacare.js.map +1 -1
- package/lib/commonjs/assets/digital_topup/index.js +2 -0
- package/lib/commonjs/assets/digital_topup/index.js.flow +28 -0
- package/lib/commonjs/assets/digital_topup/index.js.map +1 -0
- package/lib/commonjs/assets/digital_topup/step1.svg +31 -0
- package/lib/commonjs/assets/digital_topup/step1_disable.svg +31 -0
- package/lib/commonjs/assets/digital_topup/step1_success.svg +21 -0
- package/lib/commonjs/assets/digital_topup/step2.svg +39 -0
- package/lib/commonjs/assets/digital_topup/step2_disable.svg +16 -0
- package/lib/commonjs/assets/digital_topup/step2_success.svg +21 -0
- package/lib/commonjs/assets/digital_topup/step3.svg +23 -0
- package/lib/commonjs/assets/digital_topup/step3_disable.svg +10 -0
- package/lib/commonjs/assets/digital_topup/step3_success.svg +21 -0
- package/lib/commonjs/assets/digital_topup/step4_disable.svg +16 -0
- package/lib/commonjs/assets/digital_topup/step4_success.svg +21 -0
- package/lib/commonjs/components/AlertLoan.js +1 -1
- package/lib/commonjs/components/AlertLoan.js.flow +1 -1
- package/lib/commonjs/components/AlertLoan.js.map +1 -1
- package/lib/commonjs/components/ItemTimaOneV3.js +1 -1
- package/lib/commonjs/components/ItemTimaOneV3.js.flow +1 -5
- package/lib/commonjs/components/ItemTimaOneV3.js.map +1 -1
- package/lib/commonjs/components/MHeader.js +1 -1
- package/lib/commonjs/components/MHeader.js.flow +3 -2
- package/lib/commonjs/components/MHeader.js.map +1 -1
- package/lib/commonjs/components/ModalOptionLoan.js +1 -1
- package/lib/commonjs/components/ModalOptionLoan.js.flow +4 -2
- package/lib/commonjs/components/ModalOptionLoan.js.map +1 -1
- package/lib/commonjs/components/ModalOptionLoanDigital.js +2 -0
- package/lib/commonjs/components/ModalOptionLoanDigital.js.flow +297 -0
- package/lib/commonjs/components/ModalOptionLoanDigital.js.map +1 -0
- package/lib/commonjs/navigation/primary-navigator.js +1 -1
- package/lib/commonjs/navigation/primary-navigator.js.flow +0 -3
- package/lib/commonjs/navigation/primary-navigator.js.map +1 -1
- package/lib/commonjs/screens/camera/CCCDCameraScreen.js +1 -1
- package/lib/commonjs/screens/camera/CCCDCameraScreen.js.flow +299 -126
- package/lib/commonjs/screens/camera/CCCDCameraScreen.js.map +1 -1
- package/lib/commonjs/screens/detail-loan/QrPayment.js +1 -1
- package/lib/commonjs/screens/detail-loan/QrPayment.js.flow +1 -0
- package/lib/commonjs/screens/detail-loan/QrPayment.js.map +1 -1
- package/lib/commonjs/screens/detail-loan/ShowQrCode.js +1 -1
- package/lib/commonjs/screens/detail-loan/ShowQrCode.js.flow +1 -1
- package/lib/commonjs/screens/detail-loan/ShowQrCode.js.map +1 -1
- package/lib/commonjs/screens/home/DigitalTopupItem.js +2 -0
- package/lib/commonjs/screens/home/DigitalTopupItem.js.flow +562 -0
- package/lib/commonjs/screens/home/DigitalTopupItem.js.map +1 -0
- package/lib/commonjs/screens/home/index.js +1 -1
- package/lib/commonjs/screens/home/index.js.flow +49 -4
- package/lib/commonjs/screens/home/index.js.map +1 -1
- package/lib/commonjs/screens/liveness-v2/index.js +1 -1
- package/lib/commonjs/screens/liveness-v2/index.js.flow +12 -9
- package/lib/commonjs/screens/liveness-v2/index.js.map +1 -1
- package/lib/commonjs/screens/nationalID/index.js +1 -1
- package/lib/commonjs/screens/nationalID/index.js.flow +4 -2
- 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 +3 -1
- package/lib/commonjs/screens/nationalIDBack/index.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/OCR.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/OCR.js.flow +3 -1
- package/lib/commonjs/screens/toan-trinh-so/OCR.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js.flow +1 -375
- package/lib/commonjs/screens/toan-trinh-so/ReviewLoan.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSNationalIDFront.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSNationalIDFront.js.flow +12 -9
- package/lib/commonjs/screens/toan-trinh-so/TTSNationalIDFront.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js.flow +16 -10
- package/lib/commonjs/screens/toan-trinh-so/TTSSelfie.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js.flow +18 -15
- package/lib/commonjs/screens/toan-trinh-so/TTSSignLoan.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js.flow +1 -1
- package/lib/commonjs/screens/toan-trinh-so/TopupLoanInfo.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.flow +8 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleRegistration.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleRegistration.js.flow +20 -17
- package/lib/commonjs/screens/toan-trinh-so/VehicleRegistration.js.map +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleRegistrationFront.js +1 -1
- package/lib/commonjs/screens/toan-trinh-so/VehicleRegistrationFront.js.flow +14 -9
- package/lib/commonjs/screens/toan-trinh-so/VehicleRegistrationFront.js.map +1 -1
- package/lib/commonjs/screens/uploadVideo/index.js +1 -1
- package/lib/commonjs/screens/uploadVideo/index.js.flow +109 -61
- package/lib/commonjs/screens/uploadVideo/index.js.map +1 -1
- package/lib/commonjs/screens/uploadVideo/videoStore.js +1 -1
- package/lib/commonjs/screens/uploadVideo/videoStore.js.flow +4 -4
- package/lib/commonjs/screens/uploadVideo/videoStore.js.map +1 -1
- package/lib/commonjs/sdkConfig.js +1 -1
- package/lib/commonjs/sdkConfig.js.flow +6 -0
- package/lib/commonjs/sdkConfig.js.map +1 -1
- package/lib/commonjs/services/api/api.js +1 -1
- package/lib/commonjs/services/api/api.js.flow +32 -0
- package/lib/commonjs/services/api/api.js.map +1 -1
- package/lib/module/RNTimacare.js +1 -1
- package/lib/module/RNTimacare.js.map +1 -1
- package/lib/module/assets/digital_topup/index.js +2 -0
- package/lib/module/assets/digital_topup/index.js.map +1 -0
- package/lib/module/assets/digital_topup/step1.svg +31 -0
- package/lib/module/assets/digital_topup/step1_disable.svg +31 -0
- package/lib/module/assets/digital_topup/step1_success.svg +21 -0
- package/lib/module/assets/digital_topup/step2.svg +39 -0
- package/lib/module/assets/digital_topup/step2_disable.svg +16 -0
- package/lib/module/assets/digital_topup/step2_success.svg +21 -0
- package/lib/module/assets/digital_topup/step3.svg +23 -0
- package/lib/module/assets/digital_topup/step3_disable.svg +10 -0
- package/lib/module/assets/digital_topup/step3_success.svg +21 -0
- package/lib/module/assets/digital_topup/step4_disable.svg +16 -0
- package/lib/module/assets/digital_topup/step4_success.svg +21 -0
- package/lib/module/components/AlertLoan.js +1 -1
- package/lib/module/components/AlertLoan.js.map +1 -1
- package/lib/module/components/ItemTimaOneV3.js +1 -1
- package/lib/module/components/ItemTimaOneV3.js.map +1 -1
- package/lib/module/components/MHeader.js +1 -1
- package/lib/module/components/MHeader.js.map +1 -1
- package/lib/module/components/ModalOptionLoan.js +1 -1
- package/lib/module/components/ModalOptionLoan.js.map +1 -1
- package/lib/module/components/ModalOptionLoanDigital.js +2 -0
- package/lib/module/components/ModalOptionLoanDigital.js.map +1 -0
- 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 +1 -1
- package/lib/module/screens/camera/CCCDCameraScreen.js.map +1 -1
- package/lib/module/screens/detail-loan/QrPayment.js +1 -1
- package/lib/module/screens/detail-loan/QrPayment.js.map +1 -1
- package/lib/module/screens/detail-loan/ShowQrCode.js +1 -1
- package/lib/module/screens/detail-loan/ShowQrCode.js.map +1 -1
- package/lib/module/screens/home/DigitalTopupItem.js +2 -0
- package/lib/module/screens/home/DigitalTopupItem.js.map +1 -0
- package/lib/module/screens/home/index.js +1 -1
- package/lib/module/screens/home/index.js.map +1 -1
- package/lib/module/screens/liveness-v2/index.js +1 -1
- package/lib/module/screens/liveness-v2/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/toan-trinh-so/OCR.js +1 -1
- package/lib/module/screens/toan-trinh-so/OCR.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/ReviewLoan.js +1 -1
- package/lib/module/screens/toan-trinh-so/ReviewLoan.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/TTSNationalIDFront.js +1 -1
- package/lib/module/screens/toan-trinh-so/TTSNationalIDFront.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/TTSSelfie.js +1 -1
- package/lib/module/screens/toan-trinh-so/TTSSelfie.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/TTSSignLoan.js +1 -1
- package/lib/module/screens/toan-trinh-so/TTSSignLoan.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/TopupLoanInfo.js +1 -1
- package/lib/module/screens/toan-trinh-so/TopupLoanInfo.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleCamera.js +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleCamera.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleRegistration.js +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleRegistration.js.map +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleRegistrationFront.js +1 -1
- package/lib/module/screens/toan-trinh-so/VehicleRegistrationFront.js.map +1 -1
- package/lib/module/screens/uploadVideo/index.js +1 -1
- package/lib/module/screens/uploadVideo/index.js.map +1 -1
- package/lib/module/screens/uploadVideo/videoStore.js +1 -1
- package/lib/module/screens/uploadVideo/videoStore.js.map +1 -1
- package/lib/module/sdkConfig.js +1 -1
- package/lib/module/sdkConfig.js.map +1 -1
- package/lib/module/services/api/api.js +1 -1
- package/lib/module/services/api/api.js.map +1 -1
- package/lib/typescript/RNTimacare.d.ts +1 -1
- package/lib/typescript/RNTimacare.d.ts.map +1 -1
- package/lib/typescript/assets/digital_topup/index.d.ts +14 -0
- package/lib/typescript/assets/digital_topup/index.d.ts.map +1 -0
- package/lib/typescript/components/ItemTimaOneV3.d.ts.map +1 -1
- package/lib/typescript/components/MHeader.d.ts.map +1 -1
- package/lib/typescript/components/ModalOptionLoan.d.ts.map +1 -1
- package/lib/typescript/components/ModalOptionLoanDigital.d.ts +9 -0
- package/lib/typescript/components/ModalOptionLoanDigital.d.ts.map +1 -0
- package/lib/typescript/navigation/primary-navigator.d.ts.map +1 -1
- package/lib/typescript/screens/camera/CCCDCameraScreen.d.ts.map +1 -1
- package/lib/typescript/screens/detail-loan/QrPayment.d.ts.map +1 -1
- package/lib/typescript/screens/home/DigitalTopupItem.d.ts +7 -0
- package/lib/typescript/screens/home/DigitalTopupItem.d.ts.map +1 -0
- package/lib/typescript/screens/home/index.d.ts.map +1 -1
- package/lib/typescript/screens/liveness-v2/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/OCR.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/ReviewLoan.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/TTSNationalIDFront.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/TTSSelfie.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/TTSSignLoan.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/VehicleCamera.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/VehicleRegistration.d.ts.map +1 -1
- package/lib/typescript/screens/toan-trinh-so/VehicleRegistrationFront.d.ts.map +1 -1
- package/lib/typescript/screens/uploadVideo/index.d.ts.map +1 -1
- package/lib/typescript/sdkConfig.d.ts.map +1 -1
- package/lib/typescript/services/api/api.d.ts +32 -0
- package/lib/typescript/services/api/api.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/RNTimacare.tsx +2 -11
- package/src/assets/digital_topup/index.tsx +28 -0
- package/src/assets/digital_topup/step1.svg +31 -0
- package/src/assets/digital_topup/step1_disable.svg +31 -0
- package/src/assets/digital_topup/step1_success.svg +21 -0
- package/src/assets/digital_topup/step2.svg +39 -0
- package/src/assets/digital_topup/step2_disable.svg +16 -0
- package/src/assets/digital_topup/step2_success.svg +21 -0
- package/src/assets/digital_topup/step3.svg +23 -0
- package/src/assets/digital_topup/step3_disable.svg +10 -0
- package/src/assets/digital_topup/step3_success.svg +21 -0
- package/src/assets/digital_topup/step4_disable.svg +16 -0
- package/src/assets/digital_topup/step4_success.svg +21 -0
- package/src/components/AlertLoan.tsx +1 -1
- package/src/components/ItemTimaOneV3.tsx +1 -5
- package/src/components/MHeader.tsx +3 -2
- package/src/components/ModalOptionLoan.tsx +4 -2
- package/src/components/ModalOptionLoanDigital.tsx +297 -0
- package/src/navigation/primary-navigator.tsx +0 -3
- package/src/screens/camera/CCCDCameraScreen.tsx +299 -126
- package/src/screens/detail-loan/QrPayment.tsx +1 -0
- package/src/screens/detail-loan/ShowQrCode.tsx +1 -1
- package/src/screens/home/DigitalTopupItem.tsx +562 -0
- package/src/screens/home/index.tsx +49 -4
- package/src/screens/liveness-v2/index.tsx +12 -9
- package/src/screens/nationalID/index.tsx +4 -2
- package/src/screens/nationalIDBack/index.tsx +3 -1
- package/src/screens/toan-trinh-so/OCR.tsx +3 -1
- package/src/screens/toan-trinh-so/ReviewLoan.tsx +1 -375
- package/src/screens/toan-trinh-so/TTSNationalIDFront.tsx +12 -9
- package/src/screens/toan-trinh-so/TTSSelfie.tsx +16 -10
- package/src/screens/toan-trinh-so/TTSSignLoan.tsx +18 -15
- package/src/screens/toan-trinh-so/TopupLoanInfo.tsx +1 -1
- package/src/screens/toan-trinh-so/VehicleCamera.tsx +8 -1
- package/src/screens/toan-trinh-so/VehicleRegistration.tsx +20 -17
- package/src/screens/toan-trinh-so/VehicleRegistrationFront.tsx +14 -9
- package/src/screens/uploadVideo/index.tsx +109 -61
- package/src/screens/uploadVideo/videoStore.tsx +4 -4
- package/src/sdkConfig.ts +6 -0
- package/src/services/api/api.ts +32 -0
|
@@ -12,25 +12,88 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
Camera,
|
|
14
14
|
useCameraDevice,
|
|
15
|
+
useCameraFormat,
|
|
15
16
|
useCameraPermission,
|
|
16
17
|
} from 'react-native-vision-camera';
|
|
17
18
|
import { IconBackWhite, TakePhotoSvg } from '../../assets/icons';
|
|
18
19
|
import { MText } from '../../components/MText';
|
|
19
|
-
import
|
|
20
|
-
import {
|
|
21
|
-
import
|
|
20
|
+
import { useNavigation } from '@react-navigation/native';
|
|
21
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
22
|
+
import RNImageManipulator from '@oguzhnatly/react-native-image-manipulator';
|
|
22
23
|
|
|
23
24
|
const { width: screenWidth, height: screenHeight } = Dimensions.get('window');
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
|
|
26
|
+
const getImageSize = (
|
|
27
|
+
uri: string
|
|
28
|
+
): Promise<{ width: number; height: number }> =>
|
|
29
|
+
new Promise((resolve, reject) => {
|
|
30
|
+
Image.getSize(
|
|
31
|
+
uri,
|
|
32
|
+
(width, height) => resolve({ width, height }),
|
|
33
|
+
(err) => reject(err)
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const clamp = (value: number, min: number, max: number) =>
|
|
38
|
+
Math.min(Math.max(value, min), max);
|
|
39
|
+
|
|
40
|
+
const getSnapshotCropRect = ({
|
|
41
|
+
imageWidth,
|
|
42
|
+
imageHeight,
|
|
43
|
+
previewWidth,
|
|
44
|
+
previewHeight,
|
|
45
|
+
frameX,
|
|
46
|
+
frameY,
|
|
47
|
+
frameWidth,
|
|
48
|
+
frameHeight,
|
|
49
|
+
}: {
|
|
50
|
+
imageWidth: number;
|
|
51
|
+
imageHeight: number;
|
|
52
|
+
previewWidth: number;
|
|
53
|
+
previewHeight: number;
|
|
54
|
+
frameX: number;
|
|
55
|
+
frameY: number;
|
|
56
|
+
frameWidth: number;
|
|
57
|
+
frameHeight: number;
|
|
58
|
+
}) => {
|
|
59
|
+
const scaleX = imageWidth / previewWidth;
|
|
60
|
+
const scaleY = imageHeight / previewHeight;
|
|
61
|
+
const originX = clamp(frameX * scaleX, 0, imageWidth);
|
|
62
|
+
const originY = clamp(frameY * scaleY, 0, imageHeight);
|
|
63
|
+
const width = clamp(frameWidth * scaleX, 1, imageWidth - originX);
|
|
64
|
+
const height = clamp(frameHeight * scaleY, 1, imageHeight - originY);
|
|
65
|
+
|
|
66
|
+
return {
|
|
67
|
+
originX: Math.round(originX),
|
|
68
|
+
originY: Math.round(originY),
|
|
69
|
+
width: Math.round(width),
|
|
70
|
+
height: Math.round(height),
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
28
74
|
export default function CCCDCameraScreen(props) {
|
|
75
|
+
const insets = useSafeAreaInsets();
|
|
29
76
|
const navigation = useNavigation();
|
|
30
77
|
const camera = useRef(null);
|
|
31
78
|
const device = useCameraDevice('back');
|
|
32
79
|
const [cameraActive, setCameraActive] = useState(true);
|
|
33
80
|
const { hasPermission, requestPermission } = useCameraPermission();
|
|
81
|
+
const [previewLayout, setPreviewLayout] = useState({
|
|
82
|
+
width: screenWidth,
|
|
83
|
+
height: screenHeight,
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
const format = useCameraFormat(device, [
|
|
87
|
+
{
|
|
88
|
+
photoAspectRatio: previewLayout.height / previewLayout.width,
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
videoAspectRatio: previewLayout.height / previewLayout.width,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
photoResolution: 'max',
|
|
95
|
+
},
|
|
96
|
+
]);
|
|
34
97
|
|
|
35
98
|
useEffect(() => {
|
|
36
99
|
if (!hasPermission) requestPermission();
|
|
@@ -38,84 +101,194 @@ export default function CCCDCameraScreen(props) {
|
|
|
38
101
|
|
|
39
102
|
const takePicture = async () => {
|
|
40
103
|
if (camera.current == null) return;
|
|
104
|
+
try {
|
|
105
|
+
const snapshot = await camera.current.takeSnapshot({
|
|
106
|
+
quality: 100,
|
|
107
|
+
});
|
|
108
|
+
const imageUri = `file://${snapshot.path}`;
|
|
109
|
+
const normalized = await RNImageManipulator.manipulate(imageUri, [], {
|
|
110
|
+
format: 'jpg',
|
|
111
|
+
compress: 1,
|
|
112
|
+
});
|
|
113
|
+
const { width: imageWidth, height: imageHeight } = await getImageSize(
|
|
114
|
+
normalized.uri
|
|
115
|
+
);
|
|
116
|
+
|
|
117
|
+
const previewWidth = previewLayout.width;
|
|
118
|
+
const previewHeight = previewLayout.height;
|
|
119
|
+
|
|
120
|
+
const frameWidth = previewWidth * 0.85;
|
|
121
|
+
const frameHeight = frameWidth * 0.63;
|
|
122
|
+
const frameX = (previewWidth - frameWidth) / 2;
|
|
123
|
+
const frameY = (previewHeight - frameHeight) / 2;
|
|
41
124
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
},
|
|
67
|
-
resizeMode: 'contain',
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
try {
|
|
71
|
-
const croppedUri = await ImageEditor.cropImage(
|
|
72
|
-
`file://${photo.path}`,
|
|
73
|
-
cropData
|
|
74
|
-
);
|
|
75
|
-
setCameraActive(false);
|
|
76
|
-
navigation.goBack();
|
|
77
|
-
if (props.route.params.callback) {
|
|
78
|
-
props.route.params.callback(croppedUri.uri);
|
|
79
|
-
}
|
|
80
|
-
} catch (err) {
|
|
81
|
-
console.error(err);
|
|
125
|
+
const cropRect = getSnapshotCropRect({
|
|
126
|
+
imageWidth,
|
|
127
|
+
imageHeight,
|
|
128
|
+
previewWidth,
|
|
129
|
+
previewHeight,
|
|
130
|
+
frameX,
|
|
131
|
+
frameY,
|
|
132
|
+
frameWidth,
|
|
133
|
+
frameHeight,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const result = await RNImageManipulator.manipulate(
|
|
137
|
+
normalized.uri,
|
|
138
|
+
[
|
|
139
|
+
{
|
|
140
|
+
crop: cropRect,
|
|
141
|
+
},
|
|
142
|
+
],
|
|
143
|
+
{ format: 'jpg', compress: 1 }
|
|
144
|
+
);
|
|
145
|
+
setCameraActive(false);
|
|
146
|
+
navigation.goBack();
|
|
147
|
+
if (props.route?.params?.callback) {
|
|
148
|
+
props.route.params.callback(result?.uri);
|
|
82
149
|
}
|
|
83
|
-
})
|
|
150
|
+
} catch (err) {
|
|
151
|
+
console.error(err);
|
|
152
|
+
}
|
|
84
153
|
};
|
|
85
154
|
|
|
86
155
|
if (!device || !hasPermission)
|
|
87
|
-
return
|
|
156
|
+
return (
|
|
157
|
+
<View
|
|
158
|
+
style={{
|
|
159
|
+
flex: 1,
|
|
160
|
+
backgroundColor: '#000',
|
|
161
|
+
alignItems: 'center',
|
|
162
|
+
justifyContent: 'center',
|
|
163
|
+
}}
|
|
164
|
+
>
|
|
165
|
+
<MText style={{ color: '#fff' }}>
|
|
166
|
+
Vui lòng cấp quyền truy cập Camera
|
|
167
|
+
</MText>
|
|
168
|
+
</View>
|
|
169
|
+
);
|
|
170
|
+
|
|
171
|
+
const frameWidth = previewLayout.width * 0.85;
|
|
172
|
+
const frameHeight = frameWidth * 0.63;
|
|
173
|
+
const frameX = (previewLayout.width - frameWidth) / 2;
|
|
174
|
+
const frameY = (previewLayout.height - frameHeight) / 2;
|
|
175
|
+
|
|
88
176
|
return (
|
|
89
|
-
<View
|
|
90
|
-
|
|
177
|
+
<View
|
|
178
|
+
style={$container}
|
|
179
|
+
onLayout={(e) => {
|
|
180
|
+
const { width, height } = e.nativeEvent.layout;
|
|
181
|
+
if (width > 0 && height > 0) setPreviewLayout({ width, height });
|
|
182
|
+
}}
|
|
183
|
+
>
|
|
184
|
+
<Camera
|
|
185
|
+
style={{ flex: 1 }}
|
|
186
|
+
device={device}
|
|
187
|
+
isActive={cameraActive}
|
|
188
|
+
photo={false}
|
|
189
|
+
video={true}
|
|
190
|
+
outputOrientation="preview"
|
|
191
|
+
ref={camera}
|
|
192
|
+
format={format}
|
|
193
|
+
resizeMode="cover"
|
|
194
|
+
/>
|
|
195
|
+
<View style={$overlay} pointerEvents="none">
|
|
196
|
+
<View style={[$darkOverlayTop, { height: frameY }]} />
|
|
197
|
+
<View style={$row}>
|
|
198
|
+
<View
|
|
199
|
+
style={[$darkOverlaySide, { width: frameX, height: frameHeight }]}
|
|
200
|
+
/>
|
|
201
|
+
<View
|
|
202
|
+
style={[$frameBorder, { width: frameWidth, height: frameHeight }]}
|
|
203
|
+
>
|
|
204
|
+
{/* Top Left */}
|
|
205
|
+
<Corner
|
|
206
|
+
style={{
|
|
207
|
+
top: 0,
|
|
208
|
+
left: 0,
|
|
209
|
+
borderTopWidth: CORNER_WIDTH,
|
|
210
|
+
borderLeftWidth: CORNER_WIDTH,
|
|
211
|
+
borderColor: BORDER_COLOR,
|
|
212
|
+
}}
|
|
213
|
+
/>
|
|
214
|
+
|
|
215
|
+
{/* Top Right */}
|
|
216
|
+
<Corner
|
|
217
|
+
style={{
|
|
218
|
+
top: 0,
|
|
219
|
+
right: 0,
|
|
220
|
+
borderTopWidth: CORNER_WIDTH,
|
|
221
|
+
borderRightWidth: CORNER_WIDTH,
|
|
222
|
+
borderColor: BORDER_COLOR,
|
|
223
|
+
}}
|
|
224
|
+
/>
|
|
225
|
+
|
|
226
|
+
{/* Bottom Left */}
|
|
227
|
+
<Corner
|
|
228
|
+
style={{
|
|
229
|
+
bottom: 0,
|
|
230
|
+
left: 0,
|
|
231
|
+
borderBottomWidth: CORNER_WIDTH,
|
|
232
|
+
borderLeftWidth: CORNER_WIDTH,
|
|
233
|
+
borderColor: BORDER_COLOR,
|
|
234
|
+
}}
|
|
235
|
+
/>
|
|
236
|
+
|
|
237
|
+
{/* Bottom Right */}
|
|
238
|
+
<Corner
|
|
239
|
+
style={{
|
|
240
|
+
bottom: 0,
|
|
241
|
+
right: 0,
|
|
242
|
+
borderBottomWidth: CORNER_WIDTH,
|
|
243
|
+
borderRightWidth: CORNER_WIDTH,
|
|
244
|
+
borderColor: BORDER_COLOR,
|
|
245
|
+
}}
|
|
246
|
+
/>
|
|
247
|
+
</View>
|
|
248
|
+
<View
|
|
249
|
+
style={[$darkOverlaySide, { width: frameX, height: frameHeight }]}
|
|
250
|
+
/>
|
|
251
|
+
</View>
|
|
252
|
+
<View style={[$darkOverlayBottom, { height: frameY }]} />
|
|
253
|
+
</View>
|
|
254
|
+
<View style={[$back, { top: insets.top + 16 }]}>
|
|
91
255
|
<TouchableOpacity
|
|
92
256
|
onPress={() => {
|
|
93
257
|
navigation.goBack();
|
|
94
258
|
}}
|
|
95
|
-
style={
|
|
96
|
-
|
|
97
|
-
|
|
259
|
+
style={{
|
|
260
|
+
position: 'absolute',
|
|
261
|
+
left: 0,
|
|
262
|
+
width: 48,
|
|
263
|
+
height: 48,
|
|
264
|
+
zIndex: 1000,
|
|
265
|
+
alignItems: 'center',
|
|
266
|
+
}}
|
|
98
267
|
>
|
|
99
268
|
<IconBackWhite />
|
|
100
269
|
</TouchableOpacity>
|
|
270
|
+
<MText
|
|
271
|
+
style={{
|
|
272
|
+
textAlign: 'center',
|
|
273
|
+
zIndex: 10,
|
|
274
|
+
color: '#FFFFFF',
|
|
275
|
+
fontSize: 16,
|
|
276
|
+
}}
|
|
277
|
+
>
|
|
278
|
+
{props?.route?.params?.front
|
|
279
|
+
? 'Chụp CMND/ CCCD mặt trước'
|
|
280
|
+
: 'Chụp CMND/ CCCD mặt sau'}
|
|
281
|
+
</MText>
|
|
101
282
|
</View>
|
|
102
|
-
<
|
|
103
|
-
style={
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
<View style={styles.row}>
|
|
112
|
-
<View style={styles.darkOverlaySide} />
|
|
113
|
-
<View style={styles.frameBorder} />
|
|
114
|
-
<View style={styles.darkOverlaySide} />
|
|
115
|
-
</View>
|
|
116
|
-
<View style={styles.darkOverlayBottom} />
|
|
117
|
-
</View>
|
|
118
|
-
<View style={styles.captureButton}>
|
|
283
|
+
<View
|
|
284
|
+
style={{
|
|
285
|
+
position: 'absolute',
|
|
286
|
+
bottom: 24 + insets.bottom,
|
|
287
|
+
alignSelf: 'center',
|
|
288
|
+
flexDirection: 'column',
|
|
289
|
+
alignItems: 'center',
|
|
290
|
+
}}
|
|
291
|
+
>
|
|
119
292
|
<MText
|
|
120
293
|
style={{
|
|
121
294
|
color: '#fff',
|
|
@@ -135,59 +308,59 @@ export default function CCCDCameraScreen(props) {
|
|
|
135
308
|
);
|
|
136
309
|
}
|
|
137
310
|
|
|
311
|
+
const CORNER_SIZE = 20;
|
|
312
|
+
const CORNER_WIDTH = 2;
|
|
313
|
+
const BORDER_COLOR = '#FDFDFD';
|
|
314
|
+
|
|
315
|
+
const Corner = ({ style }: { style: ViewStyle }) => (
|
|
316
|
+
<View
|
|
317
|
+
style={[
|
|
318
|
+
style,
|
|
319
|
+
{
|
|
320
|
+
position: 'absolute',
|
|
321
|
+
width: CORNER_SIZE,
|
|
322
|
+
height: CORNER_SIZE,
|
|
323
|
+
},
|
|
324
|
+
]}
|
|
325
|
+
/>
|
|
326
|
+
);
|
|
327
|
+
|
|
138
328
|
const overlayColor = 'rgba(22, 22, 22, 0.7)';
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
},
|
|
178
|
-
captureButton: {
|
|
179
|
-
position: 'absolute',
|
|
180
|
-
bottom: 30,
|
|
181
|
-
alignSelf: 'center',
|
|
182
|
-
flexDirection: 'column',
|
|
183
|
-
alignItems: 'center',
|
|
184
|
-
},
|
|
185
|
-
topContainer: {
|
|
186
|
-
position: 'absolute',
|
|
187
|
-
top: DeviceInfo.hasNotch() ? 60 : 24,
|
|
188
|
-
},
|
|
189
|
-
textContainer: {
|
|
190
|
-
position: 'absolute',
|
|
191
|
-
top: DeviceInfo.hasNotch() ? 60 : 24,
|
|
192
|
-
},
|
|
193
|
-
});
|
|
329
|
+
const $back: ViewStyle = {
|
|
330
|
+
position: 'absolute',
|
|
331
|
+
left: 0,
|
|
332
|
+
right: 0,
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
const $overlay: ViewStyle = {
|
|
336
|
+
...StyleSheet.absoluteFillObject,
|
|
337
|
+
justifyContent: 'center',
|
|
338
|
+
alignItems: 'center',
|
|
339
|
+
};
|
|
340
|
+
|
|
341
|
+
const $container: ViewStyle = {
|
|
342
|
+
flex: 1,
|
|
343
|
+
backgroundColor: '#000',
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
const $row: ViewStyle = {
|
|
347
|
+
flexDirection: 'row',
|
|
348
|
+
alignItems: 'center',
|
|
349
|
+
};
|
|
350
|
+
|
|
351
|
+
const $darkOverlayTop: ViewStyle = {
|
|
352
|
+
width: '100%',
|
|
353
|
+
backgroundColor: overlayColor,
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
const $darkOverlayBottom: ViewStyle = {
|
|
357
|
+
width: '100%',
|
|
358
|
+
backgroundColor: overlayColor,
|
|
359
|
+
};
|
|
360
|
+
const $darkOverlaySide: ViewStyle = {
|
|
361
|
+
backgroundColor: overlayColor,
|
|
362
|
+
};
|
|
363
|
+
const $frameBorder: ViewStyle = {
|
|
364
|
+
// borderColor: '#FDFDFD',
|
|
365
|
+
// borderWidth: 2,
|
|
366
|
+
};
|
|
@@ -34,7 +34,7 @@ export const ShowQrCode = observer(function ShowQrCode(props: any) {
|
|
|
34
34
|
.getQrPayment({
|
|
35
35
|
LoanBriefId: props?.route?.params?.id,
|
|
36
36
|
TypeCloseLoan: 0, // đóng tiền kỳ
|
|
37
|
-
Money: props?.route?.params?.amount,
|
|
37
|
+
Money: Number(props?.route?.params?.amount),
|
|
38
38
|
})
|
|
39
39
|
.then((response) => {
|
|
40
40
|
setIsLoading(false);
|