react-native-expo-cropper 1.2.52 → 1.3.53
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/dist/CustomCamera.js +164 -55
- package/dist/ImageCropper.js +133 -428
- package/dist/ImageCropperStyles.js +152 -182
- package/package.json +1 -1
- package/src/CustomCamera.js +147 -54
- package/src/ImageCropper.js +161 -430
- package/src/ImageCropperStyles.js +159 -199
package/dist/CustomCamera.js
CHANGED
|
@@ -9,6 +9,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
10
|
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
11
11
|
var _expoCamera = require("expo-camera");
|
|
12
|
+
var _vectorIcons = require("@expo/vector-icons");
|
|
12
13
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t3 in e) "default" !== _t3 && {}.hasOwnProperty.call(e, _t3) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t3)) && (i.get || i.set) ? o(f, _t3, i) : f[_t3] = e[_t3]); return f; })(e, t); }
|
|
13
14
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
14
15
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -29,7 +30,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
29
30
|
var CAMERA_PREVIEW_MAX_WIDTH = 500;
|
|
30
31
|
function CustomCamera(_ref) {
|
|
31
32
|
var onPhotoCaptured = _ref.onPhotoCaptured,
|
|
32
|
-
|
|
33
|
+
onCancel = _ref.onCancel,
|
|
33
34
|
_ref$instructionText = _ref.instructionText,
|
|
34
35
|
instructionText = _ref$instructionText === void 0 ? 'Place the tray inside the green box' : _ref$instructionText;
|
|
35
36
|
var _useWindowDimensions = (0, _reactNative.useWindowDimensions)(),
|
|
@@ -320,9 +321,7 @@ function CustomCamera(_ref) {
|
|
|
320
321
|
});
|
|
321
322
|
console.log("Camera wrapper layout updated:", layout);
|
|
322
323
|
}
|
|
323
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
324
|
-
style: styles.cameraInstruction
|
|
325
|
-
}, instructionText), /*#__PURE__*/_react["default"].createElement(_expoCamera.CameraView, {
|
|
324
|
+
}, /*#__PURE__*/_react["default"].createElement(_expoCamera.CameraView, {
|
|
326
325
|
style: styles.camera,
|
|
327
326
|
facing: "back",
|
|
328
327
|
ref: cameraRef,
|
|
@@ -333,7 +332,11 @@ function CustomCamera(_ref) {
|
|
|
333
332
|
// ✅ Ensure camera uses native aspect ratio (typically 4:3 for most devices)
|
|
334
333
|
// The wrapper constrains the view, but capture uses full sensor resolution
|
|
335
334
|
// This ensures preview matches what will be captured
|
|
336
|
-
}),
|
|
335
|
+
}), /*#__PURE__*/_react["default"].createElement(_reactNative.View, {
|
|
336
|
+
style: [styles.topBar, styles.topBarCentered]
|
|
337
|
+
}, /*#__PURE__*/_react["default"].createElement(_reactNative.Text, {
|
|
338
|
+
style: [styles.topBarTitle, styles.topBarCenteredTitle]
|
|
339
|
+
}, instructionText)), loadingBeforeCapture && /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_reactNative.View, {
|
|
337
340
|
style: styles.loadingOverlay
|
|
338
341
|
}, /*#__PURE__*/_react["default"].createElement(_reactNative.ActivityIndicator, {
|
|
339
342
|
size: "large",
|
|
@@ -350,18 +353,26 @@ function CustomCamera(_ref) {
|
|
|
350
353
|
}]
|
|
351
354
|
})), /*#__PURE__*/_react["default"].createElement(_reactNative.View, {
|
|
352
355
|
style: [styles.buttonContainer, {
|
|
353
|
-
bottom: ((insets === null || insets === void 0 ? void 0 : insets.bottom) || 0) +
|
|
356
|
+
bottom: ((insets === null || insets === void 0 ? void 0 : insets.bottom) || 0) + 12,
|
|
354
357
|
marginBottom: 0
|
|
355
358
|
}]
|
|
356
359
|
}, /*#__PURE__*/_react["default"].createElement(_reactNative.TouchableOpacity, {
|
|
357
|
-
style: styles.
|
|
360
|
+
style: [styles.captureButton, (!isReady || loadingBeforeCapture || !hasPermission) && {
|
|
361
|
+
opacity: 0.55
|
|
362
|
+
}],
|
|
358
363
|
onPress: takePicture,
|
|
359
364
|
disabled: !isReady || loadingBeforeCapture || !hasPermission
|
|
360
|
-
}
|
|
365
|
+
}, /*#__PURE__*/_react["default"].createElement(_vectorIcons.Ionicons, {
|
|
366
|
+
name: "camera-outline",
|
|
367
|
+
size: 26,
|
|
368
|
+
color: "#121212"
|
|
369
|
+
})))));
|
|
361
370
|
}
|
|
362
|
-
var PRIMARY_GREEN = '#
|
|
363
|
-
var
|
|
364
|
-
var
|
|
371
|
+
var PRIMARY_GREEN = '#689F38';
|
|
372
|
+
var ACCENT_GREEN = '#689F38';
|
|
373
|
+
var DEEP_BLACK = '#060708';
|
|
374
|
+
var GLOW_WHITE = 'rgba(255, 255, 255, 0.9)';
|
|
375
|
+
var GLASS = 'rgba(20,22,26,0.9)';
|
|
365
376
|
var styles = _reactNative.StyleSheet.create({
|
|
366
377
|
outerContainer: {
|
|
367
378
|
flex: 1,
|
|
@@ -384,10 +395,12 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
384
395
|
},
|
|
385
396
|
permissionButton: {
|
|
386
397
|
marginTop: 16,
|
|
387
|
-
backgroundColor:
|
|
398
|
+
backgroundColor: GLASS,
|
|
388
399
|
paddingHorizontal: 16,
|
|
389
400
|
paddingVertical: 10,
|
|
390
|
-
borderRadius:
|
|
401
|
+
borderRadius: 12,
|
|
402
|
+
borderWidth: 1,
|
|
403
|
+
borderColor: 'rgba(255,255,255,0.12)'
|
|
391
404
|
},
|
|
392
405
|
permissionButtonText: {
|
|
393
406
|
color: 'white',
|
|
@@ -395,7 +408,7 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
395
408
|
},
|
|
396
409
|
cameraWrapper: {
|
|
397
410
|
aspectRatio: 9 / 16,
|
|
398
|
-
borderRadius:
|
|
411
|
+
borderRadius: 0,
|
|
399
412
|
overflow: 'hidden',
|
|
400
413
|
alignItems: 'center',
|
|
401
414
|
justifyContent: 'center',
|
|
@@ -403,30 +416,29 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
403
416
|
},
|
|
404
417
|
cameraInstruction: {
|
|
405
418
|
position: 'absolute',
|
|
406
|
-
|
|
407
|
-
left:
|
|
408
|
-
right:
|
|
419
|
+
bottom: 170,
|
|
420
|
+
left: 18,
|
|
421
|
+
right: 18,
|
|
409
422
|
textAlign: 'center',
|
|
410
|
-
color:
|
|
411
|
-
fontSize:
|
|
412
|
-
fontWeight: '
|
|
423
|
+
color: 'rgba(255,255,255,0.82)',
|
|
424
|
+
fontSize: 13,
|
|
425
|
+
fontWeight: '500',
|
|
413
426
|
zIndex: 10,
|
|
414
|
-
textShadowColor: 'rgba(0, 0, 0, 0.
|
|
427
|
+
textShadowColor: 'rgba(0, 0, 0, 0.6)',
|
|
415
428
|
textShadowOffset: {
|
|
416
429
|
width: 0,
|
|
417
430
|
height: 1
|
|
418
431
|
},
|
|
419
432
|
textShadowRadius: 2,
|
|
420
|
-
// Allow camera/scan frame to still receive touches
|
|
421
433
|
pointerEvents: 'none'
|
|
422
434
|
},
|
|
423
435
|
camera: _objectSpread({}, _reactNative.StyleSheet.absoluteFillObject),
|
|
424
436
|
scanFrame: {
|
|
425
437
|
position: 'absolute',
|
|
426
|
-
borderWidth:
|
|
427
|
-
borderColor:
|
|
428
|
-
borderRadius:
|
|
429
|
-
backgroundColor: 'rgba(
|
|
438
|
+
borderWidth: 2,
|
|
439
|
+
borderColor: ACCENT_GREEN,
|
|
440
|
+
borderRadius: 2,
|
|
441
|
+
backgroundColor: 'rgba(158, 249, 107, 0.08)'
|
|
430
442
|
},
|
|
431
443
|
loadingOverlay: _objectSpread(_objectSpread({}, _reactNative.StyleSheet.absoluteFillObject), {}, {
|
|
432
444
|
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
@@ -438,45 +450,142 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
438
450
|
zIndex: 21,
|
|
439
451
|
backgroundColor: 'transparent'
|
|
440
452
|
}),
|
|
441
|
-
cancelIcon: {
|
|
442
|
-
position: 'absolute',
|
|
443
|
-
top: 20,
|
|
444
|
-
left: 20,
|
|
445
|
-
backgroundColor: PRIMARY_GREEN,
|
|
446
|
-
borderRadius: 5,
|
|
447
|
-
padding: 8
|
|
448
|
-
},
|
|
449
453
|
buttonContainer: {
|
|
450
454
|
position: 'absolute',
|
|
451
455
|
bottom: 0,
|
|
452
|
-
|
|
453
|
-
|
|
456
|
+
left: 0,
|
|
457
|
+
right: 0,
|
|
458
|
+
marginBottom: 8,
|
|
459
|
+
alignItems: 'center',
|
|
454
460
|
justifyContent: 'center'
|
|
455
461
|
},
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
borderColor: PRIMARY_GREEN,
|
|
462
|
+
captureButton: {
|
|
463
|
+
marginTop: 10,
|
|
464
|
+
width: 68,
|
|
465
|
+
height: 68,
|
|
466
|
+
borderRadius: 20,
|
|
467
|
+
backgroundColor: ACCENT_GREEN,
|
|
463
468
|
alignItems: 'center',
|
|
464
|
-
justifyContent: 'center'
|
|
469
|
+
justifyContent: 'center',
|
|
470
|
+
shadowColor: ACCENT_GREEN,
|
|
471
|
+
shadowOpacity: 0.42,
|
|
472
|
+
shadowRadius: 10,
|
|
473
|
+
shadowOffset: {
|
|
474
|
+
width: 0,
|
|
475
|
+
height: 2
|
|
476
|
+
},
|
|
477
|
+
elevation: 8
|
|
465
478
|
},
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
479
|
+
topBar: {
|
|
480
|
+
position: 'absolute',
|
|
481
|
+
top: 0,
|
|
482
|
+
left: 0,
|
|
483
|
+
right: 0,
|
|
484
|
+
zIndex: 20,
|
|
485
|
+
flexDirection: 'row',
|
|
486
|
+
alignItems: 'center',
|
|
487
|
+
justifyContent: 'space-between',
|
|
488
|
+
paddingHorizontal: 18
|
|
469
489
|
},
|
|
470
|
-
|
|
471
|
-
flex: 1,
|
|
472
|
-
backgroundColor: DEEP_BLACK,
|
|
490
|
+
topBarCentered: {
|
|
473
491
|
justifyContent: 'center',
|
|
474
492
|
alignItems: 'center',
|
|
475
|
-
|
|
493
|
+
paddingHorizontal: 0
|
|
476
494
|
},
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
495
|
+
topIconButton: {
|
|
496
|
+
width: 36,
|
|
497
|
+
height: 36,
|
|
498
|
+
borderRadius: 12,
|
|
499
|
+
backgroundColor: 'rgba(0,0,0,0.35)',
|
|
500
|
+
alignItems: 'center',
|
|
501
|
+
justifyContent: 'center'
|
|
502
|
+
},
|
|
503
|
+
topBarTitle: {
|
|
504
|
+
color: ACCENT_GREEN,
|
|
505
|
+
fontSize: 30,
|
|
506
|
+
fontWeight: '700',
|
|
507
|
+
letterSpacing: 0.3
|
|
508
|
+
},
|
|
509
|
+
topBarCenteredTitle: {
|
|
510
|
+
width: '100%',
|
|
511
|
+
textAlign: 'center',
|
|
512
|
+
paddingHorizontal: 18
|
|
513
|
+
},
|
|
514
|
+
detectBadge: {
|
|
515
|
+
position: 'absolute',
|
|
516
|
+
top: 76,
|
|
517
|
+
left: 18,
|
|
518
|
+
zIndex: 20,
|
|
519
|
+
backgroundColor: 'rgba(40, 44, 50, 0.82)',
|
|
520
|
+
borderRadius: 16,
|
|
521
|
+
paddingHorizontal: 14,
|
|
522
|
+
paddingVertical: 10
|
|
523
|
+
},
|
|
524
|
+
detectBadgeText: {
|
|
525
|
+
color: 'rgba(255,255,255,0.78)',
|
|
526
|
+
fontSize: 12,
|
|
527
|
+
fontWeight: '700',
|
|
528
|
+
letterSpacing: 1.6,
|
|
529
|
+
textTransform: 'uppercase'
|
|
530
|
+
},
|
|
531
|
+
cornerHandle: {
|
|
532
|
+
position: 'absolute',
|
|
533
|
+
width: 24,
|
|
534
|
+
height: 24,
|
|
535
|
+
borderRadius: 12,
|
|
536
|
+
backgroundColor: '#DFFFD0',
|
|
537
|
+
borderWidth: 2,
|
|
538
|
+
borderColor: ACCENT_GREEN,
|
|
539
|
+
shadowColor: ACCENT_GREEN,
|
|
540
|
+
shadowOpacity: 0.55,
|
|
541
|
+
shadowRadius: 10,
|
|
542
|
+
shadowOffset: {
|
|
543
|
+
width: 0,
|
|
544
|
+
height: 0
|
|
545
|
+
},
|
|
546
|
+
elevation: 8,
|
|
547
|
+
zIndex: 25
|
|
548
|
+
},
|
|
549
|
+
dockLabel: {
|
|
550
|
+
marginTop: 10,
|
|
551
|
+
marginBottom: 10,
|
|
552
|
+
color: 'rgba(255,255,255,0.63)',
|
|
553
|
+
textAlign: 'center',
|
|
554
|
+
fontSize: 12,
|
|
555
|
+
letterSpacing: 3.2,
|
|
556
|
+
textTransform: 'uppercase'
|
|
557
|
+
},
|
|
558
|
+
dock: {
|
|
559
|
+
height: 76,
|
|
560
|
+
width: '92%',
|
|
561
|
+
borderRadius: 22,
|
|
562
|
+
backgroundColor: 'rgba(27,30,35,0.92)',
|
|
563
|
+
borderWidth: 1,
|
|
564
|
+
borderColor: 'rgba(255,255,255,0.08)',
|
|
565
|
+
flexDirection: 'row',
|
|
566
|
+
alignItems: 'center',
|
|
567
|
+
justifyContent: 'space-around',
|
|
568
|
+
paddingHorizontal: 12
|
|
569
|
+
},
|
|
570
|
+
dockButton: {
|
|
571
|
+
width: 44,
|
|
572
|
+
height: 44,
|
|
573
|
+
borderRadius: 14,
|
|
574
|
+
alignItems: 'center',
|
|
575
|
+
justifyContent: 'center'
|
|
576
|
+
},
|
|
577
|
+
dockButtonActive: {
|
|
578
|
+
width: 74,
|
|
579
|
+
height: 52,
|
|
580
|
+
borderRadius: 16,
|
|
581
|
+
backgroundColor: ACCENT_GREEN,
|
|
582
|
+
shadowColor: ACCENT_GREEN,
|
|
583
|
+
shadowOpacity: 0.4,
|
|
584
|
+
shadowRadius: 10,
|
|
585
|
+
shadowOffset: {
|
|
586
|
+
width: 0,
|
|
587
|
+
height: 1
|
|
588
|
+
},
|
|
589
|
+
elevation: 8
|
|
481
590
|
}
|
|
482
591
|
});
|