react-native-expo-cropper 1.2.51 → 1.2.52
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 +25 -2
- package/dist/ImageCropper.js +4 -1
- package/package.json +1 -1
- package/src/CustomCamera.js +24 -1
- package/src/ImageCropper.js +2 -0
package/dist/CustomCamera.js
CHANGED
|
@@ -29,7 +29,9 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
29
29
|
var CAMERA_PREVIEW_MAX_WIDTH = 500;
|
|
30
30
|
function CustomCamera(_ref) {
|
|
31
31
|
var onPhotoCaptured = _ref.onPhotoCaptured,
|
|
32
|
-
onFrameCalculated = _ref.onFrameCalculated
|
|
32
|
+
onFrameCalculated = _ref.onFrameCalculated,
|
|
33
|
+
_ref$instructionText = _ref.instructionText,
|
|
34
|
+
instructionText = _ref$instructionText === void 0 ? 'Place the tray inside the green box' : _ref$instructionText;
|
|
33
35
|
var _useWindowDimensions = (0, _reactNative.useWindowDimensions)(),
|
|
34
36
|
windowWidth = _useWindowDimensions.width;
|
|
35
37
|
var cameraPreviewWidth = Math.min(windowWidth, CAMERA_PREVIEW_MAX_WIDTH);
|
|
@@ -318,7 +320,9 @@ function CustomCamera(_ref) {
|
|
|
318
320
|
});
|
|
319
321
|
console.log("Camera wrapper layout updated:", layout);
|
|
320
322
|
}
|
|
321
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
323
|
+
}, /*#__PURE__*/_react["default"].createElement(_reactNative.Text, {
|
|
324
|
+
style: styles.cameraInstruction
|
|
325
|
+
}, instructionText), /*#__PURE__*/_react["default"].createElement(_expoCamera.CameraView, {
|
|
322
326
|
style: styles.camera,
|
|
323
327
|
facing: "back",
|
|
324
328
|
ref: cameraRef,
|
|
@@ -397,6 +401,25 @@ var styles = _reactNative.StyleSheet.create({
|
|
|
397
401
|
justifyContent: 'center',
|
|
398
402
|
position: 'relative'
|
|
399
403
|
},
|
|
404
|
+
cameraInstruction: {
|
|
405
|
+
position: 'absolute',
|
|
406
|
+
top: 8,
|
|
407
|
+
left: 12,
|
|
408
|
+
right: 12,
|
|
409
|
+
textAlign: 'center',
|
|
410
|
+
color: GLOW_WHITE,
|
|
411
|
+
fontSize: 14,
|
|
412
|
+
fontWeight: '600',
|
|
413
|
+
zIndex: 10,
|
|
414
|
+
textShadowColor: 'rgba(0, 0, 0, 0.7)',
|
|
415
|
+
textShadowOffset: {
|
|
416
|
+
width: 0,
|
|
417
|
+
height: 1
|
|
418
|
+
},
|
|
419
|
+
textShadowRadius: 2,
|
|
420
|
+
// Allow camera/scan frame to still receive touches
|
|
421
|
+
pointerEvents: 'none'
|
|
422
|
+
},
|
|
400
423
|
camera: _objectSpread({}, _reactNative.StyleSheet.absoluteFillObject),
|
|
401
424
|
scanFrame: {
|
|
402
425
|
position: 'absolute',
|
package/dist/ImageCropper.js
CHANGED
|
@@ -50,7 +50,9 @@ var ImageCropper = function ImageCropper(_ref) {
|
|
|
50
50
|
_ref$confirmText = _ref.confirmText,
|
|
51
51
|
confirmText = _ref$confirmText === void 0 ? 'Confirm' : _ref$confirmText,
|
|
52
52
|
_ref$resetText = _ref.resetText,
|
|
53
|
-
resetText = _ref$resetText === void 0 ? 'Reset' : _ref$resetText
|
|
53
|
+
resetText = _ref$resetText === void 0 ? 'Reset' : _ref$resetText,
|
|
54
|
+
_ref$cameraInstructio = _ref.cameraInstructionText,
|
|
55
|
+
cameraInstructionText = _ref$cameraInstructio === void 0 ? 'Place the tray inside the green box' : _ref$cameraInstructio;
|
|
54
56
|
var _useWindowDimensions = (0, _reactNative.useWindowDimensions)(),
|
|
55
57
|
windowWidth = _useWindowDimensions.width,
|
|
56
58
|
windowHeight = _useWindowDimensions.height;
|
|
@@ -1228,6 +1230,7 @@ var ImageCropper = function ImageCropper(_ref) {
|
|
|
1228
1230
|
return /*#__PURE__*/_react["default"].createElement(_reactNative.View, {
|
|
1229
1231
|
style: _ImageCropperStyles["default"].container
|
|
1230
1232
|
}, showCustomCamera ? /*#__PURE__*/_react["default"].createElement(_CustomCamera["default"], {
|
|
1233
|
+
instructionText: cameraInstructionText,
|
|
1231
1234
|
onPhotoCaptured: function onPhotoCaptured(uri, frameData) {
|
|
1232
1235
|
// ✅ CRITICAL FIX: Store green frame coordinates for coordinate conversion
|
|
1233
1236
|
if (frameData && frameData.greenFrame) {
|
package/package.json
CHANGED
package/src/CustomCamera.js
CHANGED
|
@@ -16,7 +16,11 @@ import { Camera, CameraView } from 'expo-camera';
|
|
|
16
16
|
// Max width for camera preview on large screens (tablets) so it doesn't stretch full width
|
|
17
17
|
const CAMERA_PREVIEW_MAX_WIDTH = 500;
|
|
18
18
|
|
|
19
|
-
export default function CustomCamera({
|
|
19
|
+
export default function CustomCamera({
|
|
20
|
+
onPhotoCaptured,
|
|
21
|
+
onFrameCalculated,
|
|
22
|
+
instructionText = 'Place the tray inside the green box',
|
|
23
|
+
}) {
|
|
20
24
|
const { width: windowWidth } = useWindowDimensions();
|
|
21
25
|
const cameraPreviewWidth = Math.min(windowWidth, CAMERA_PREVIEW_MAX_WIDTH);
|
|
22
26
|
const [isReady, setIsReady] = useState(false);
|
|
@@ -250,6 +254,9 @@ export default function CustomCamera({ onPhotoCaptured, onFrameCalculated }) {
|
|
|
250
254
|
console.log("Camera wrapper layout updated:", layout);
|
|
251
255
|
}}
|
|
252
256
|
>
|
|
257
|
+
<Text style={styles.cameraInstruction}>
|
|
258
|
+
{instructionText}
|
|
259
|
+
</Text>
|
|
253
260
|
<CameraView
|
|
254
261
|
style={styles.camera}
|
|
255
262
|
facing="back"
|
|
@@ -345,6 +352,22 @@ const styles = StyleSheet.create({
|
|
|
345
352
|
justifyContent: 'center',
|
|
346
353
|
position: 'relative',
|
|
347
354
|
},
|
|
355
|
+
cameraInstruction: {
|
|
356
|
+
position: 'absolute',
|
|
357
|
+
top: 8,
|
|
358
|
+
left: 12,
|
|
359
|
+
right: 12,
|
|
360
|
+
textAlign: 'center',
|
|
361
|
+
color: GLOW_WHITE,
|
|
362
|
+
fontSize: 14,
|
|
363
|
+
fontWeight: '600',
|
|
364
|
+
zIndex: 10,
|
|
365
|
+
textShadowColor: 'rgba(0, 0, 0, 0.7)',
|
|
366
|
+
textShadowOffset: { width: 0, height: 1 },
|
|
367
|
+
textShadowRadius: 2,
|
|
368
|
+
// Allow camera/scan frame to still receive touches
|
|
369
|
+
pointerEvents: 'none',
|
|
370
|
+
},
|
|
348
371
|
camera: {
|
|
349
372
|
...StyleSheet.absoluteFillObject,
|
|
350
373
|
},
|
package/src/ImageCropper.js
CHANGED
|
@@ -22,6 +22,7 @@ const ImageCropper = ({
|
|
|
22
22
|
onCancel,
|
|
23
23
|
confirmText = 'Confirm',
|
|
24
24
|
resetText = 'Reset',
|
|
25
|
+
cameraInstructionText = 'Place the tray inside the green box',
|
|
25
26
|
}) => {
|
|
26
27
|
const { width: windowWidth, height: windowHeight } = useWindowDimensions();
|
|
27
28
|
|
|
@@ -1053,6 +1054,7 @@ const rotatePreviewImage = async (degrees) => {
|
|
|
1053
1054
|
|
|
1054
1055
|
{showCustomCamera ? (
|
|
1055
1056
|
<CustomCamera
|
|
1057
|
+
instructionText={cameraInstructionText}
|
|
1056
1058
|
onPhotoCaptured={(uri, frameData) => {
|
|
1057
1059
|
// ✅ CRITICAL FIX: Store green frame coordinates for coordinate conversion
|
|
1058
1060
|
if (frameData && frameData.greenFrame) {
|