react-native-timacare 3.3.29 → 3.3.31

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.
Files changed (29) hide show
  1. package/lib/commonjs/screens/camera/CCCDCameraScreen.js +1 -1
  2. package/lib/commonjs/screens/camera/CCCDCameraScreen.js.flow +18 -13
  3. package/lib/commonjs/screens/camera/CCCDCameraScreen.js.map +1 -1
  4. package/lib/commonjs/screens/liveness-v2/index.js +1 -1
  5. package/lib/commonjs/screens/liveness-v2/index.js.flow +2 -7
  6. package/lib/commonjs/screens/liveness-v2/index.js.map +1 -1
  7. package/lib/commonjs/screens/toan-trinh-so/OCR.js +1 -1
  8. package/lib/commonjs/screens/toan-trinh-so/OCR.js.flow +21 -99
  9. package/lib/commonjs/screens/toan-trinh-so/OCR.js.map +1 -1
  10. package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js +1 -1
  11. package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js.flow +49 -28
  12. package/lib/commonjs/screens/toan-trinh-so/RegisterCamera.js.map +1 -1
  13. package/lib/module/screens/camera/CCCDCameraScreen.js +1 -1
  14. package/lib/module/screens/camera/CCCDCameraScreen.js.map +1 -1
  15. package/lib/module/screens/liveness-v2/index.js +1 -1
  16. package/lib/module/screens/liveness-v2/index.js.map +1 -1
  17. package/lib/module/screens/toan-trinh-so/OCR.js +1 -1
  18. package/lib/module/screens/toan-trinh-so/OCR.js.map +1 -1
  19. package/lib/module/screens/toan-trinh-so/RegisterCamera.js +1 -1
  20. package/lib/module/screens/toan-trinh-so/RegisterCamera.js.map +1 -1
  21. package/lib/typescript/screens/camera/CCCDCameraScreen.d.ts.map +1 -1
  22. package/lib/typescript/screens/liveness-v2/index.d.ts.map +1 -1
  23. package/lib/typescript/screens/toan-trinh-so/OCR.d.ts.map +1 -1
  24. package/lib/typescript/screens/toan-trinh-so/RegisterCamera.d.ts.map +1 -1
  25. package/package.json +1 -1
  26. package/src/screens/camera/CCCDCameraScreen.tsx +18 -13
  27. package/src/screens/liveness-v2/index.tsx +2 -7
  28. package/src/screens/toan-trinh-so/OCR.tsx +21 -99
  29. package/src/screens/toan-trinh-so/RegisterCamera.tsx +49 -28
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/screens/liveness-v2/index.tsx"],"names":[],"mappings":"AAgDA,eAAO,MAAM,UAAU,KAskBrB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/screens/liveness-v2/index.tsx"],"names":[],"mappings":"AAgDA,eAAO,MAAM,UAAU,KAikBrB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"OCR.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/OCR.tsx"],"names":[],"mappings":"AA4DA,eAAO,MAAM,GAAG,KAkvBd,CAAC"}
1
+ {"version":3,"file":"OCR.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/OCR.tsx"],"names":[],"mappings":"AA4DA,eAAO,MAAM,GAAG,KA8pBd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"RegisterCamera.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/RegisterCamera.tsx"],"names":[],"mappings":"AAwCA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,GAAG,eAochD"}
1
+ {"version":3,"file":"RegisterCamera.d.ts","sourceRoot":"","sources":["../../../../src/screens/toan-trinh-so/RegisterCamera.tsx"],"names":[],"mappings":"AAyCA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,KAAK,EAAE,GAAG,eAochD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-timacare",
3
- "version": "3.3.29",
3
+ "version": "3.3.31",
4
4
  "description": "SDK Tima Care",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -181,18 +181,16 @@ export default function CCCDCameraScreen(props) {
181
181
  ]}
182
182
  >
183
183
  {device ? (
184
- <VisionCamera
185
- ref={myCamera}
186
- style={{
187
- width: Dimensions.get('window').width,
188
- height: 260,
189
- overflow: 'hidden',
190
- }}
191
- device={device}
192
- isActive={true}
193
- photo={true}
194
- format={format}
195
- />
184
+ <View style={$cameraFrame}>
185
+ <VisionCamera
186
+ ref={myCamera}
187
+ style={StyleSheet.absoluteFill}
188
+ device={device}
189
+ isActive={true}
190
+ photo={true}
191
+ format={format}
192
+ />
193
+ </View>
196
194
  ) : (
197
195
  <ActivityIndicator />
198
196
  )}
@@ -230,7 +228,7 @@ export default function CCCDCameraScreen(props) {
230
228
  <View
231
229
  style={{
232
230
  position: 'absolute',
233
- bottom: 24 + insets.bottom,
231
+ bottom: insets.bottom,
234
232
  alignSelf: 'center',
235
233
  flexDirection: 'column',
236
234
  alignItems: 'center',
@@ -262,6 +260,13 @@ const $back: ViewStyle = {
262
260
  right: 0,
263
261
  };
264
262
 
263
+ const $cameraFrame: ViewStyle = {
264
+ width: Dimensions.get('window').width,
265
+ height: 260,
266
+ overflow: 'hidden',
267
+ backgroundColor: 'black',
268
+ };
269
+
265
270
  const $overlay: ViewStyle = {
266
271
  ...StyleSheet.absoluteFillObject,
267
272
  justifyContent: 'center',
@@ -368,7 +368,7 @@ export const LivenessV2 = observer(function LivenessV2(props: any) {
368
368
  stopped = true;
369
369
  cameraRef.current?.stopRecording();
370
370
  }
371
- }, 3000);
371
+ }, 3500);
372
372
  cameraRef.current.startRecording({
373
373
  videoCodec: Platform.OS === 'ios' ? 'h264' : undefined,
374
374
  onRecordingFinished: (video) => {
@@ -383,17 +383,12 @@ export const LivenessV2 = observer(function LivenessV2(props: any) {
383
383
  });
384
384
  if (data.path) {
385
385
  setIsLoading(true);
386
- // captureFromVideo(data.uri);
387
386
  const newPath =
388
387
  CachesDirectoryPath + '/' + new Date().getTime() + '.mp4';
389
388
  await RNFS.copyFile(data.path, newPath).then(() => {
390
389
  console.log('Copied to:', newPath);
391
390
  });
392
- const thump = await extractFramesFromVideo(
393
- Platform.OS === 'android'
394
- ? 'file://' + data.path
395
- : 'file://' + newPath
396
- );
391
+ const thump = await extractFramesFromVideo(data.path);
397
392
  if (thump.length > 0) {
398
393
  uploadLiveness(thump);
399
394
  }
@@ -397,91 +397,7 @@ export const OCR = observer(function OCR(props: any) {
397
397
  >
398
398
  <IconBackWhite />
399
399
  </TouchableOpacity>
400
- <View
401
- style={{
402
- flexDirection: 'row',
403
- padding: 2,
404
- borderRadius: 4,
405
- alignItems: 'center',
406
- backgroundColor: 'transparent',
407
- }}
408
- >
409
- {/* <TouchableOpacity
410
- style={{}}
411
- onPress={() => {
412
- setType('passport');
413
- }}
414
- >
415
- <LinearGradient
416
- colors={
417
- type === 'passport'
418
- ? ['#FF8E4F', '#EF592E']
419
- : ['black', 'black']
420
- }
421
- style={{
422
- height: 28,
423
- paddingHorizontal: 8,
424
- borderRadius: 4,
425
- width: 100,
426
- flexDirection: 'row',
427
- alignItems: 'center',
428
- }}
429
- >
430
- <Cam2Svg />
431
- <MText
432
- style={{
433
- color: 'white',
434
- fontSize: 12,
435
- fontWeight: 'bold',
436
- marginLeft: 5,
437
- }}
438
- >
439
- Chụp 2 mặt
440
- </MText>
441
- </LinearGradient>
442
- </TouchableOpacity> */}
443
- {/* <View
444
- style={{
445
- backgroundColor: 'white',
446
- width: 1,
447
- borderRadius: 10,
448
- height: 20,
449
- marginHorizontal: 8,
450
- }}
451
- ></View> */}
452
- {/* <TouchableOpacity
453
- style={{}}
454
- onPress={() => {
455
- setType('nfc');
456
- }}
457
- >
458
- <LinearGradient
459
- colors={
460
- type === 'nfc' ? ['#FF8E4F', '#EF592E'] : ['black', 'black']
461
- }
462
- style={{
463
- height: 28,
464
- paddingHorizontal: 8,
465
- borderRadius: 4,
466
- width: 100,
467
- flexDirection: 'row',
468
- alignItems: 'center',
469
- }}
470
- >
471
- <ChipSvg />
472
- <MText
473
- style={{
474
- color: 'white',
475
- fontSize: 12,
476
- fontWeight: 'bold',
477
- marginLeft: 5,
478
- }}
479
- >
480
- NFC
481
- </MText>
482
- </LinearGradient>
483
- </TouchableOpacity> */}
484
- </View>
400
+
485
401
  <MText
486
402
  style={{
487
403
  color: 'white',
@@ -513,18 +429,16 @@ export const OCR = observer(function OCR(props: any) {
513
429
  ]}
514
430
  >
515
431
  {device ? (
516
- <VisionCamera
517
- ref={myCamera}
518
- style={{
519
- width: Dimensions.get('window').width,
520
- height: 260,
521
- overflow: 'hidden',
522
- }}
523
- device={device}
524
- isActive={true}
525
- photo={true}
526
- format={format}
527
- />
432
+ <View style={styles.passportCameraFrame}>
433
+ <VisionCamera
434
+ ref={myCamera}
435
+ style={StyleSheet.absoluteFill}
436
+ device={device}
437
+ isActive={true}
438
+ photo={true}
439
+ format={format}
440
+ />
441
+ </View>
528
442
  ) : (
529
443
  <ActivityIndicator />
530
444
  )}
@@ -535,7 +449,6 @@ export const OCR = observer(function OCR(props: any) {
535
449
  style={{
536
450
  flexDirection: 'row',
537
451
  alignItems: 'center',
538
- gap: 8,
539
452
  marginTop: 16,
540
453
  }}
541
454
  >
@@ -544,6 +457,7 @@ export const OCR = observer(function OCR(props: any) {
544
457
  style={{
545
458
  color: 'white',
546
459
  fontSize: 12,
460
+ marginLeft: 8,
547
461
  }}
548
462
  >
549
463
  Tải ảnh từ thư viện
@@ -592,7 +506,9 @@ export const OCR = observer(function OCR(props: any) {
592
506
  </View>
593
507
  <View style={styles.overlayBottom} />
594
508
  </View>
595
- <View style={styles.buttonContainer}>
509
+ <View
510
+ style={[styles.buttonContainer, { bottom: insets.bottom + 24 }]}
511
+ >
596
512
  <MText
597
513
  style={{
598
514
  color: 'white',
@@ -881,6 +797,12 @@ const styles = StyleSheet.create({
881
797
  camera: {
882
798
  flex: 1,
883
799
  },
800
+ passportCameraFrame: {
801
+ width: Dimensions.get('window').width,
802
+ height: 260,
803
+ overflow: 'hidden',
804
+ backgroundColor: 'black',
805
+ },
884
806
  buttonContainer: {
885
807
  flex: 0,
886
808
  flexDirection: 'column',
@@ -2,15 +2,16 @@
2
2
  import React, { useEffect, useRef, useState } from 'react';
3
3
  import {
4
4
  ActivityIndicator,
5
- Dimensions,
6
5
  Image,
7
6
  ImageStyle,
8
7
  Platform,
8
+ StyleSheet,
9
9
  TextStyle,
10
10
  TouchableOpacity,
11
11
  View,
12
12
  ViewStyle,
13
13
  Alert,
14
+ useWindowDimensions,
14
15
  } from 'react-native';
15
16
  import { useNavigation, useIsFocused } from '@react-navigation/native';
16
17
  import {
@@ -41,6 +42,8 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
41
42
  export default function RegisterCamera(props: any) {
42
43
  const insets = useSafeAreaInsets();
43
44
  const isFocused = useIsFocused();
45
+ const { width: screenWidth, height: screenHeight } = useWindowDimensions();
46
+ const cameraHeight = (screenWidth * 4) / 3.1;
44
47
  const [shouldRenderCamera, setShouldRenderCamera] = useState(false);
45
48
  const navigation = useNavigation();
46
49
  const [showModal, setShowModal] = useState(false);
@@ -240,28 +243,18 @@ export default function RegisterCamera(props: any) {
240
243
  style={[
241
244
  commonStyles.fill,
242
245
  {
243
- width: Dimensions.get('window').width,
244
- height: Dimensions.get('window').height,
245
- // alignItems: 'center',
246
+ width: screenWidth,
247
+ height: screenHeight,
246
248
  zIndex: 1000,
247
249
  },
248
250
  ]}
249
251
  >
250
- <View
251
- style={{
252
- marginVertical: 16,
253
- marginTop: insets.top + 16,
254
- }}
255
- >
252
+ <View style={[styles.header, { paddingTop: insets.top + 16 }]}>
256
253
  <TouchableOpacity
257
254
  onPress={() => {
258
255
  navigation.goBack();
259
256
  }}
260
- style={{
261
- position: 'absolute',
262
- left: 16,
263
- zIndex: 100000,
264
- }}
257
+ style={[styles.backButton, { top: insets.top + 16 }]}
265
258
  >
266
259
  <MText
267
260
  style={{
@@ -284,17 +277,25 @@ export default function RegisterCamera(props: any) {
284
277
  </MText>
285
278
  </View>
286
279
  {device ? (
287
- <VisionCamera
288
- ref={myCamera}
289
- style={{
290
- width: Dimensions.get('window').width,
291
- height: (Dimensions.get('window').width * 4) / 3.1,
292
- }}
293
- device={device}
294
- isActive={true}
295
- photo={true}
296
- format={format}
297
- />
280
+ <View
281
+ style={[
282
+ styles.cameraFrame,
283
+ {
284
+ width: screenWidth,
285
+ height: cameraHeight,
286
+ marginTop: insets.top + 64,
287
+ },
288
+ ]}
289
+ >
290
+ <VisionCamera
291
+ ref={myCamera}
292
+ style={StyleSheet.absoluteFill}
293
+ device={device}
294
+ isActive={true}
295
+ photo={true}
296
+ format={format}
297
+ />
298
+ </View>
298
299
  ) : (
299
300
  <ActivityIndicator />
300
301
  )}
@@ -316,7 +317,6 @@ export default function RegisterCamera(props: any) {
316
317
  style={{
317
318
  flexDirection: 'row',
318
319
  alignItems: 'center',
319
- gap: 8,
320
320
  }}
321
321
  >
322
322
  <IconUpload />
@@ -324,6 +324,7 @@ export default function RegisterCamera(props: any) {
324
324
  style={{
325
325
  color: 'white',
326
326
  fontSize: 12,
327
+ marginLeft: 8,
327
328
  }}
328
329
  >
329
330
  Tải ảnh từ thư viện
@@ -343,7 +344,7 @@ export default function RegisterCamera(props: any) {
343
344
  <View
344
345
  style={{
345
346
  alignItems: 'center',
346
- marginVertical: DeviceInfo.hasNotch() ? 24 : 16,
347
+ marginTop: 16,
347
348
  }}
348
349
  >
349
350
  <MButton
@@ -551,3 +552,23 @@ const $container: ViewStyle = {
551
552
  borderTopRightRadius: 26,
552
553
  borderTopLeftRadius: 26,
553
554
  };
555
+
556
+ const styles = StyleSheet.create({
557
+ header: {
558
+ position: 'absolute',
559
+ top: 0,
560
+ left: 0,
561
+ right: 0,
562
+ zIndex: 10,
563
+ paddingBottom: 16,
564
+ },
565
+ backButton: {
566
+ position: 'absolute',
567
+ left: 16,
568
+ zIndex: 100000,
569
+ },
570
+ cameraFrame: {
571
+ overflow: 'hidden',
572
+ backgroundColor: 'black',
573
+ },
574
+ });