react-native-timacare 3.3.10 → 3.3.12
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 -2
- package/lib/commonjs/RNTimacare.js.map +1 -1
- package/lib/commonjs/screens/camera/CCCDCameraScreen.js +1 -1
- package/lib/commonjs/screens/camera/CCCDCameraScreen.js.flow +257 -200
- package/lib/commonjs/screens/camera/CCCDCameraScreen.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/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/module/RNTimacare.js +1 -1
- package/lib/module/RNTimacare.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/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/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/typescript/RNTimacare.d.ts +1 -1
- package/lib/typescript/RNTimacare.d.ts.map +1 -1
- package/lib/typescript/screens/camera/CCCDCameraScreen.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/uploadVideo/index.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/RNTimacare.tsx +2 -2
- package/src/screens/camera/CCCDCameraScreen.tsx +257 -200
- package/src/screens/nationalID/index.tsx +4 -2
- package/src/screens/nationalIDBack/index.tsx +3 -1
- package/src/screens/uploadVideo/index.tsx +109 -61
- package/src/screens/uploadVideo/videoStore.tsx +4 -4
|
@@ -9,111 +9,48 @@ import {
|
|
|
9
9
|
TouchableOpacity,
|
|
10
10
|
View,
|
|
11
11
|
} from 'react-native';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
Camera,
|
|
14
|
+
useCameraDevice,
|
|
15
|
+
useCameraPermission,
|
|
16
|
+
} from 'react-native-vision-camera';
|
|
13
17
|
import { IconBackWhite, TakePhotoSvg } from '../../assets/icons';
|
|
14
18
|
import { MText } from '../../components/MText';
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
request,
|
|
20
|
-
PERMISSIONS,
|
|
21
|
-
RESULTS,
|
|
22
|
-
openSettings,
|
|
23
|
-
} from 'react-native-permissions';
|
|
19
|
+
import { useNavigation } from '@react-navigation/native';
|
|
20
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
21
|
+
import RNImageManipulator from '@oguzhnatly/react-native-image-manipulator';
|
|
24
22
|
|
|
25
23
|
const { width: screenWidth, height: screenHeight } = Dimensions.get('window');
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
24
|
+
|
|
25
|
+
const getImageSize = (
|
|
26
|
+
uri: string
|
|
27
|
+
): Promise<{ width: number; height: number }> =>
|
|
28
|
+
new Promise((resolve, reject) => {
|
|
29
|
+
Image.getSize(
|
|
30
|
+
uri,
|
|
31
|
+
(width, height) => resolve({ width, height }),
|
|
32
|
+
(err) => reject(err)
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
const clamp = (value: number, min: number, max: number) =>
|
|
37
|
+
Math.min(Math.max(value, min), max);
|
|
38
|
+
|
|
30
39
|
export default function CCCDCameraScreen(props) {
|
|
40
|
+
const insets = useSafeAreaInsets();
|
|
31
41
|
const navigation = useNavigation();
|
|
32
42
|
const camera = useRef(null);
|
|
33
43
|
const device = useCameraDevice('back');
|
|
34
44
|
const [cameraActive, setCameraActive] = useState(true);
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
? PERMISSIONS.IOS.CAMERA
|
|
41
|
-
: PERMISSIONS.ANDROID.CAMERA
|
|
42
|
-
).then((result) => {
|
|
43
|
-
switch (result) {
|
|
44
|
-
case RESULTS.UNAVAILABLE:
|
|
45
|
-
console.log(
|
|
46
|
-
'This feature is not available (on this device / in this context)'
|
|
47
|
-
);
|
|
48
|
-
Alert.alert(
|
|
49
|
-
'Thông báo',
|
|
50
|
-
'Máy ảnh trên thiết bị không tương thích.\nVui lòng kiểm tra lại thiết bị!',
|
|
51
|
-
[{ text: 'Đồng ý' }]
|
|
52
|
-
);
|
|
53
|
-
break;
|
|
54
|
-
case RESULTS.DENIED:
|
|
55
|
-
console.log(
|
|
56
|
-
'The permission has not been requested / is denied but requestable'
|
|
57
|
-
);
|
|
58
|
-
Alert.alert(
|
|
59
|
-
'Thông báo',
|
|
60
|
-
'Bạn đã từ chối quyền máy ảnh. Vui lòng cấp quyền máy ảnh để tiếp tục!',
|
|
61
|
-
[
|
|
62
|
-
{
|
|
63
|
-
text: 'Đồng ý',
|
|
64
|
-
onPress: () => {
|
|
65
|
-
if (Platform.OS === 'ios') {
|
|
66
|
-
openSettings();
|
|
67
|
-
} else {
|
|
68
|
-
requestPermissions();
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
]
|
|
73
|
-
);
|
|
74
|
-
break;
|
|
75
|
-
case RESULTS.LIMITED:
|
|
76
|
-
console.log('The permission is limited: some actions are possible');
|
|
77
|
-
Alert.alert(
|
|
78
|
-
'Thông báo',
|
|
79
|
-
'Quyền máy ảnh bị hạn chế. Vui lòng kiểm tra lại để tiếp tục!',
|
|
80
|
-
[
|
|
81
|
-
{
|
|
82
|
-
text: 'Đồng ý',
|
|
83
|
-
onPress: () => {
|
|
84
|
-
if (Platform.OS === 'ios') {
|
|
85
|
-
openSettings();
|
|
86
|
-
} else {
|
|
87
|
-
requestPermissions();
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
]
|
|
92
|
-
);
|
|
93
|
-
break;
|
|
94
|
-
case RESULTS.GRANTED:
|
|
95
|
-
console.log('The permission is granted');
|
|
96
|
-
setPassPermission(true);
|
|
97
|
-
break;
|
|
98
|
-
case RESULTS.BLOCKED:
|
|
99
|
-
console.log('The permission is denied and not requestable anymore');
|
|
100
|
-
Alert.alert(
|
|
101
|
-
'Thông báo',
|
|
102
|
-
'Bạn đã từ chối quyền máy ảnh. Vui lòng cấp quyền máy ảnh để tiếp tục!',
|
|
103
|
-
[
|
|
104
|
-
{
|
|
105
|
-
text: 'Đồng ý',
|
|
106
|
-
},
|
|
107
|
-
]
|
|
108
|
-
);
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
};
|
|
45
|
+
const { hasPermission, requestPermission } = useCameraPermission();
|
|
46
|
+
const [previewLayout, setPreviewLayout] = useState({
|
|
47
|
+
width: screenWidth,
|
|
48
|
+
height: screenHeight,
|
|
49
|
+
});
|
|
113
50
|
|
|
114
51
|
useEffect(() => {
|
|
115
|
-
|
|
116
|
-
}, []);
|
|
52
|
+
if (!hasPermission) requestPermission();
|
|
53
|
+
}, [hasPermission, requestPermission]);
|
|
117
54
|
|
|
118
55
|
const takePicture = async () => {
|
|
119
56
|
if (camera.current == null) return;
|
|
@@ -122,79 +59,199 @@ export default function CCCDCameraScreen(props) {
|
|
|
122
59
|
skipMetadata: true,
|
|
123
60
|
});
|
|
124
61
|
|
|
125
|
-
|
|
126
|
-
const
|
|
62
|
+
try {
|
|
63
|
+
const imageUri = `file://${photo.path}`;
|
|
64
|
+
const { width, height } = await getImageSize(imageUri);
|
|
65
|
+
const previewWidth = previewLayout.width || screenWidth;
|
|
66
|
+
const previewHeight = previewLayout.height || screenHeight;
|
|
67
|
+
|
|
68
|
+
const frameWidth = previewWidth * 0.85;
|
|
69
|
+
const frameHeight = frameWidth * 0.63; // tỷ lệ giống CCCD
|
|
70
|
+
const frameX = (previewWidth - frameWidth) / 2;
|
|
71
|
+
const frameY = (previewHeight - frameHeight) / 2;
|
|
72
|
+
|
|
73
|
+
// Tính scale dựa trên `resizeMode="cover"` mặc định của Vision Camera phủ kín màn hình
|
|
74
|
+
const scale = Math.max(previewWidth / width, previewHeight / height);
|
|
75
|
+
|
|
76
|
+
// Kích thước của ảnh nếu được hiển thị và zoom lên để cover màn hình
|
|
77
|
+
const renderedWidth = width * scale;
|
|
78
|
+
const renderedHeight = height * scale;
|
|
79
|
+
|
|
80
|
+
// Độ phân giải của các phần bị tràn ra khỏi màn hình (do cover)
|
|
81
|
+
const offsetX = (renderedWidth - previewWidth) / 2;
|
|
82
|
+
const offsetY = (renderedHeight - previewHeight) / 2;
|
|
83
|
+
|
|
84
|
+
// Tính tọa độ vùng cần crop trên ảnh gốc dựa vào toạ độ của khung UI
|
|
85
|
+
const cropX = (frameX + offsetX) / scale;
|
|
86
|
+
const cropY = (frameY + offsetY) / scale;
|
|
87
|
+
const cropWidth = frameWidth / scale;
|
|
88
|
+
const cropHeight = frameHeight / scale;
|
|
127
89
|
|
|
128
|
-
|
|
129
|
-
const
|
|
130
|
-
const
|
|
90
|
+
const cropXInt = Math.floor(clamp(cropX, 0, Math.max(0, width - 1)));
|
|
91
|
+
const cropYInt = Math.floor(clamp(cropY, 0, Math.max(0, height - 1)));
|
|
92
|
+
const cropWidthInt = Math.floor(
|
|
93
|
+
clamp(cropWidth, 1, Math.max(1, width - cropXInt))
|
|
94
|
+
);
|
|
95
|
+
const cropHeightInt = Math.floor(
|
|
96
|
+
clamp(cropHeight, 1, Math.max(1, height - cropYInt))
|
|
97
|
+
);
|
|
131
98
|
|
|
132
|
-
// Tính tọa độ vùng cần crop trên ảnh gốc
|
|
133
99
|
const cropData = {
|
|
134
100
|
offset: {
|
|
135
|
-
x:
|
|
136
|
-
y:
|
|
101
|
+
x: cropXInt,
|
|
102
|
+
y: cropYInt,
|
|
137
103
|
},
|
|
138
104
|
size: {
|
|
139
|
-
width:
|
|
140
|
-
height:
|
|
105
|
+
width: cropWidthInt,
|
|
106
|
+
height: cropHeightInt,
|
|
141
107
|
},
|
|
142
|
-
displaySize: {
|
|
143
|
-
width: frameWidth * scaleX,
|
|
144
|
-
height: frameHeight * scaleY,
|
|
145
|
-
},
|
|
146
|
-
resizeMode: 'contain',
|
|
147
108
|
};
|
|
148
109
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
110
|
+
const result = await RNImageManipulator.manipulate(
|
|
111
|
+
imageUri,
|
|
112
|
+
[
|
|
113
|
+
{
|
|
114
|
+
crop: {
|
|
115
|
+
originX: cropXInt,
|
|
116
|
+
originY: cropYInt,
|
|
117
|
+
width: cropWidthInt,
|
|
118
|
+
height: cropHeightInt,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
{ format: 'jpg', compress: 1 }
|
|
123
|
+
);
|
|
124
|
+
setCameraActive(false);
|
|
125
|
+
navigation.goBack();
|
|
126
|
+
|
|
127
|
+
if (props.route?.params?.callback) {
|
|
128
|
+
props.route.params.callback(result?.uri);
|
|
161
129
|
}
|
|
162
|
-
})
|
|
130
|
+
} catch (err) {
|
|
131
|
+
console.error(err);
|
|
132
|
+
}
|
|
163
133
|
};
|
|
164
134
|
|
|
165
|
-
if (!device || !
|
|
135
|
+
if (!device || !hasPermission)
|
|
166
136
|
return <View style={{ flex: 1, backgroundColor: '#000' }} />;
|
|
137
|
+
|
|
138
|
+
const frameWidth = previewLayout.width * 0.85;
|
|
139
|
+
const frameHeight = frameWidth * 0.63;
|
|
140
|
+
const frameX = (previewLayout.width - frameWidth) / 2;
|
|
141
|
+
const frameY = (previewLayout.height - frameHeight) / 2;
|
|
142
|
+
|
|
167
143
|
return (
|
|
168
|
-
<View
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
{ width: 48, height: 48, zIndex: 1000, alignItems: 'center' },
|
|
176
|
-
]}
|
|
177
|
-
>
|
|
178
|
-
<IconBackWhite />
|
|
179
|
-
</TouchableOpacity>
|
|
180
|
-
</View>
|
|
144
|
+
<View
|
|
145
|
+
style={$container}
|
|
146
|
+
onLayout={(e) => {
|
|
147
|
+
const { width, height } = e.nativeEvent.layout;
|
|
148
|
+
if (width > 0 && height > 0) setPreviewLayout({ width, height });
|
|
149
|
+
}}
|
|
150
|
+
>
|
|
181
151
|
<Camera
|
|
182
|
-
style={
|
|
152
|
+
style={{ flex: 1 }}
|
|
183
153
|
device={device}
|
|
184
154
|
isActive={cameraActive}
|
|
185
155
|
photo={true}
|
|
186
156
|
ref={camera}
|
|
187
157
|
/>
|
|
188
|
-
<View style={
|
|
189
|
-
<View style={
|
|
190
|
-
<View style={
|
|
191
|
-
<View
|
|
192
|
-
|
|
193
|
-
|
|
158
|
+
<View style={$overlay} pointerEvents="none">
|
|
159
|
+
<View style={[$darkOverlayTop, { height: frameY }]} />
|
|
160
|
+
<View style={$row}>
|
|
161
|
+
<View
|
|
162
|
+
style={[$darkOverlaySide, { width: frameX, height: frameHeight }]}
|
|
163
|
+
/>
|
|
164
|
+
<View
|
|
165
|
+
style={[$frameBorder, { width: frameWidth, height: frameHeight }]}
|
|
166
|
+
>
|
|
167
|
+
{/* Top Left */}
|
|
168
|
+
<Corner
|
|
169
|
+
style={{
|
|
170
|
+
top: 0,
|
|
171
|
+
left: 0,
|
|
172
|
+
borderTopWidth: CORNER_WIDTH,
|
|
173
|
+
borderLeftWidth: CORNER_WIDTH,
|
|
174
|
+
borderColor: BORDER_COLOR,
|
|
175
|
+
}}
|
|
176
|
+
/>
|
|
177
|
+
|
|
178
|
+
{/* Top Right */}
|
|
179
|
+
<Corner
|
|
180
|
+
style={{
|
|
181
|
+
top: 0,
|
|
182
|
+
right: 0,
|
|
183
|
+
borderTopWidth: CORNER_WIDTH,
|
|
184
|
+
borderRightWidth: CORNER_WIDTH,
|
|
185
|
+
borderColor: BORDER_COLOR,
|
|
186
|
+
}}
|
|
187
|
+
/>
|
|
188
|
+
|
|
189
|
+
{/* Bottom Left */}
|
|
190
|
+
<Corner
|
|
191
|
+
style={{
|
|
192
|
+
bottom: 0,
|
|
193
|
+
left: 0,
|
|
194
|
+
borderBottomWidth: CORNER_WIDTH,
|
|
195
|
+
borderLeftWidth: CORNER_WIDTH,
|
|
196
|
+
borderColor: BORDER_COLOR,
|
|
197
|
+
}}
|
|
198
|
+
/>
|
|
199
|
+
|
|
200
|
+
{/* Bottom Right */}
|
|
201
|
+
<Corner
|
|
202
|
+
style={{
|
|
203
|
+
bottom: 0,
|
|
204
|
+
right: 0,
|
|
205
|
+
borderBottomWidth: CORNER_WIDTH,
|
|
206
|
+
borderRightWidth: CORNER_WIDTH,
|
|
207
|
+
borderColor: BORDER_COLOR,
|
|
208
|
+
}}
|
|
209
|
+
/>
|
|
210
|
+
</View>
|
|
211
|
+
<View
|
|
212
|
+
style={[$darkOverlaySide, { width: frameX, height: frameHeight }]}
|
|
213
|
+
/>
|
|
194
214
|
</View>
|
|
195
|
-
<View style={
|
|
215
|
+
<View style={[$darkOverlayBottom, { height: frameY }]} />
|
|
216
|
+
</View>
|
|
217
|
+
<View style={[$back, { top: insets.top + 16 }]}>
|
|
218
|
+
<TouchableOpacity
|
|
219
|
+
onPress={() => {
|
|
220
|
+
navigation.goBack();
|
|
221
|
+
}}
|
|
222
|
+
style={{
|
|
223
|
+
position: 'absolute',
|
|
224
|
+
left: 0,
|
|
225
|
+
width: 48,
|
|
226
|
+
height: 48,
|
|
227
|
+
zIndex: 1000,
|
|
228
|
+
alignItems: 'center',
|
|
229
|
+
}}
|
|
230
|
+
>
|
|
231
|
+
<IconBackWhite />
|
|
232
|
+
</TouchableOpacity>
|
|
233
|
+
<MText
|
|
234
|
+
style={{
|
|
235
|
+
textAlign: 'center',
|
|
236
|
+
zIndex: 10,
|
|
237
|
+
color: '#FFFFFF',
|
|
238
|
+
fontSize: 16,
|
|
239
|
+
}}
|
|
240
|
+
>
|
|
241
|
+
{props?.route?.params?.front
|
|
242
|
+
? 'Chụp CMND/ CCCD mặt trước'
|
|
243
|
+
: 'Chụp CMND/ CCCD mặt sau'}
|
|
244
|
+
</MText>
|
|
196
245
|
</View>
|
|
197
|
-
<View
|
|
246
|
+
<View
|
|
247
|
+
style={{
|
|
248
|
+
position: 'absolute',
|
|
249
|
+
bottom: 24 + insets.bottom,
|
|
250
|
+
alignSelf: 'center',
|
|
251
|
+
flexDirection: 'column',
|
|
252
|
+
alignItems: 'center',
|
|
253
|
+
}}
|
|
254
|
+
>
|
|
198
255
|
<MText
|
|
199
256
|
style={{
|
|
200
257
|
color: '#fff',
|
|
@@ -214,59 +271,59 @@ export default function CCCDCameraScreen(props) {
|
|
|
214
271
|
);
|
|
215
272
|
}
|
|
216
273
|
|
|
274
|
+
const CORNER_SIZE = 20;
|
|
275
|
+
const CORNER_WIDTH = 2;
|
|
276
|
+
const BORDER_COLOR = '#FDFDFD';
|
|
277
|
+
|
|
278
|
+
const Corner = ({ style }: { style: ViewStyle }) => (
|
|
279
|
+
<View
|
|
280
|
+
style={[
|
|
281
|
+
style,
|
|
282
|
+
{
|
|
283
|
+
position: 'absolute',
|
|
284
|
+
width: CORNER_SIZE,
|
|
285
|
+
height: CORNER_SIZE,
|
|
286
|
+
},
|
|
287
|
+
]}
|
|
288
|
+
/>
|
|
289
|
+
);
|
|
290
|
+
|
|
217
291
|
const overlayColor = 'rgba(22, 22, 22, 0.7)';
|
|
218
|
-
const
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
},
|
|
257
|
-
captureButton: {
|
|
258
|
-
position: 'absolute',
|
|
259
|
-
bottom: 30,
|
|
260
|
-
alignSelf: 'center',
|
|
261
|
-
flexDirection: 'column',
|
|
262
|
-
alignItems: 'center',
|
|
263
|
-
},
|
|
264
|
-
topContainer: {
|
|
265
|
-
position: 'absolute',
|
|
266
|
-
top: DeviceInfo.hasNotch() ? 60 : 24,
|
|
267
|
-
},
|
|
268
|
-
textContainer: {
|
|
269
|
-
position: 'absolute',
|
|
270
|
-
top: DeviceInfo.hasNotch() ? 60 : 24,
|
|
271
|
-
},
|
|
272
|
-
});
|
|
292
|
+
const $back: ViewStyle = {
|
|
293
|
+
position: 'absolute',
|
|
294
|
+
left: 0,
|
|
295
|
+
right: 0,
|
|
296
|
+
};
|
|
297
|
+
|
|
298
|
+
const $overlay: ViewStyle = {
|
|
299
|
+
...StyleSheet.absoluteFillObject,
|
|
300
|
+
justifyContent: 'center',
|
|
301
|
+
alignItems: 'center',
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
const $container: ViewStyle = {
|
|
305
|
+
flex: 1,
|
|
306
|
+
backgroundColor: '#000',
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
const $row: ViewStyle = {
|
|
310
|
+
flexDirection: 'row',
|
|
311
|
+
alignItems: 'center',
|
|
312
|
+
};
|
|
313
|
+
|
|
314
|
+
const $darkOverlayTop: ViewStyle = {
|
|
315
|
+
width: '100%',
|
|
316
|
+
backgroundColor: overlayColor,
|
|
317
|
+
};
|
|
318
|
+
|
|
319
|
+
const $darkOverlayBottom: ViewStyle = {
|
|
320
|
+
width: '100%',
|
|
321
|
+
backgroundColor: overlayColor,
|
|
322
|
+
};
|
|
323
|
+
const $darkOverlaySide: ViewStyle = {
|
|
324
|
+
backgroundColor: overlayColor,
|
|
325
|
+
};
|
|
326
|
+
const $frameBorder: ViewStyle = {
|
|
327
|
+
// borderColor: '#FDFDFD',
|
|
328
|
+
// borderWidth: 2,
|
|
329
|
+
};
|
|
@@ -57,6 +57,7 @@ const logoView: ImageStyle = {
|
|
|
57
57
|
const { width: screenWidth, height: screenHeight } = Dimensions.get('window');
|
|
58
58
|
const frameWidth = screenWidth * 0.85;
|
|
59
59
|
const frameHeight = frameWidth * 0.63; // tỷ lệ giống CCCD
|
|
60
|
+
const frameAspectRatio = frameWidth / frameHeight;
|
|
60
61
|
|
|
61
62
|
export const NationalID = observer(function NationalID(props: any) {
|
|
62
63
|
const navigation = useNavigation();
|
|
@@ -99,7 +100,7 @@ export const NationalID = observer(function NationalID(props: any) {
|
|
|
99
100
|
(data) => {
|
|
100
101
|
if (data === 1) {
|
|
101
102
|
navigation.push(ScreenNames.CCCDCameraScreen, {
|
|
102
|
-
front:
|
|
103
|
+
front: true,
|
|
103
104
|
callback: (photo) => {
|
|
104
105
|
setPhoto(photo);
|
|
105
106
|
},
|
|
@@ -163,7 +164,7 @@ export const NationalID = observer(function NationalID(props: any) {
|
|
|
163
164
|
<View
|
|
164
165
|
style={{
|
|
165
166
|
width: '100%',
|
|
166
|
-
|
|
167
|
+
aspectRatio: frameAspectRatio,
|
|
167
168
|
borderWidth: 8,
|
|
168
169
|
borderRadius: 6,
|
|
169
170
|
borderColor: '#FFFFFF',
|
|
@@ -179,6 +180,7 @@ export const NationalID = observer(function NationalID(props: any) {
|
|
|
179
180
|
style={{
|
|
180
181
|
width: '100%',
|
|
181
182
|
height: '100%',
|
|
183
|
+
resizeMode: 'cover',
|
|
182
184
|
}}
|
|
183
185
|
/>
|
|
184
186
|
</View>
|
|
@@ -42,6 +42,7 @@ const logoView: ImageStyle = {
|
|
|
42
42
|
const { width: screenWidth, height: screenHeight } = Dimensions.get('window');
|
|
43
43
|
const frameWidth = screenWidth * 0.85;
|
|
44
44
|
const frameHeight = frameWidth * 0.63; // tỷ lệ giống CCCD
|
|
45
|
+
const frameAspectRatio = frameWidth / frameHeight;
|
|
45
46
|
|
|
46
47
|
export const NationalIDBack = observer(function NationalIDBack(props: any) {
|
|
47
48
|
const navigation = useNavigation();
|
|
@@ -143,7 +144,7 @@ export const NationalIDBack = observer(function NationalIDBack(props: any) {
|
|
|
143
144
|
<View
|
|
144
145
|
style={{
|
|
145
146
|
width: '100%',
|
|
146
|
-
|
|
147
|
+
aspectRatio: frameAspectRatio,
|
|
147
148
|
borderWidth: 8,
|
|
148
149
|
borderRadius: 6,
|
|
149
150
|
borderColor: '#FFFFFF',
|
|
@@ -159,6 +160,7 @@ export const NationalIDBack = observer(function NationalIDBack(props: any) {
|
|
|
159
160
|
style={{
|
|
160
161
|
width: '100%',
|
|
161
162
|
height: '100%',
|
|
163
|
+
resizeMode: 'cover',
|
|
162
164
|
}}
|
|
163
165
|
/>
|
|
164
166
|
</View>
|