react-native-expo-cropper 1.1.31 → 1.1.32
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/ImageCropper.js +27 -15
- package/package.json +4 -1
- package/src/ImageCropper.js +6 -2
package/dist/ImageCropper.js
CHANGED
|
@@ -316,28 +316,40 @@ var ImageCropper = function ImageCropper(_ref) {
|
|
|
316
316
|
setIsLoading(true);
|
|
317
317
|
setShowResult(true);
|
|
318
318
|
_context2.p = 1;
|
|
319
|
+
if (!(_reactNative.Platform.OS === 'android')) {
|
|
320
|
+
_context2.n = 3;
|
|
321
|
+
break;
|
|
322
|
+
}
|
|
319
323
|
_context2.n = 2;
|
|
320
|
-
return
|
|
324
|
+
return new Promise(function (resolve) {
|
|
325
|
+
return requestAnimationFrame(resolve);
|
|
326
|
+
});
|
|
321
327
|
case 2:
|
|
328
|
+
_context2.n = 4;
|
|
329
|
+
break;
|
|
330
|
+
case 3:
|
|
331
|
+
_context2.n = 4;
|
|
332
|
+
return waitForRender(5);
|
|
333
|
+
case 4:
|
|
322
334
|
console.log("Starting capture...");
|
|
323
|
-
_context2.n =
|
|
335
|
+
_context2.n = 5;
|
|
324
336
|
return (0, _reactNativeViewShot.captureRef)(viewRef, {
|
|
325
337
|
format: 'png',
|
|
326
338
|
quality: 1
|
|
327
339
|
});
|
|
328
|
-
case
|
|
340
|
+
case 5:
|
|
329
341
|
capturedUri = _context2.v;
|
|
330
342
|
console.log("Capture successful:", capturedUri);
|
|
331
343
|
if (capturedUri) {
|
|
332
|
-
_context2.n =
|
|
344
|
+
_context2.n = 6;
|
|
333
345
|
break;
|
|
334
346
|
}
|
|
335
347
|
throw new Error("Capture returned empty URI");
|
|
336
|
-
case
|
|
348
|
+
case 6:
|
|
337
349
|
console.log("Enhancing image...");
|
|
338
|
-
_context2.n =
|
|
350
|
+
_context2.n = 7;
|
|
339
351
|
return (0, _ImageProcessor.enhanceImage)(capturedUri, addheight);
|
|
340
|
-
case
|
|
352
|
+
case 7:
|
|
341
353
|
enhancedUri = _context2.v;
|
|
342
354
|
console.log("Image enhanced:", enhancedUri);
|
|
343
355
|
name = "IMAGE XTK".concat(Date.now(), ".png");
|
|
@@ -345,23 +357,23 @@ var ImageCropper = function ImageCropper(_ref) {
|
|
|
345
357
|
console.log("Calling onConfirm with:", enhancedUri, name);
|
|
346
358
|
onConfirm(enhancedUri, name);
|
|
347
359
|
}
|
|
348
|
-
_context2.n =
|
|
360
|
+
_context2.n = 9;
|
|
349
361
|
break;
|
|
350
|
-
case
|
|
351
|
-
_context2.p =
|
|
362
|
+
case 8:
|
|
363
|
+
_context2.p = 8;
|
|
352
364
|
_t2 = _context2.v;
|
|
353
365
|
console.error("Erreur lors de la capture :", _t2);
|
|
354
366
|
alert("Erreur lors de la capture ! " + _t2.message);
|
|
355
|
-
case
|
|
356
|
-
_context2.p =
|
|
367
|
+
case 9:
|
|
368
|
+
_context2.p = 9;
|
|
357
369
|
setShowResult(false);
|
|
358
370
|
setIsLoading(false);
|
|
359
371
|
setShowFullScreenCapture(false);
|
|
360
|
-
return _context2.f(
|
|
361
|
-
case
|
|
372
|
+
return _context2.f(9);
|
|
373
|
+
case 10:
|
|
362
374
|
return _context2.a(2);
|
|
363
375
|
}
|
|
364
|
-
}, _callee2, null, [[1,
|
|
376
|
+
}, _callee2, null, [[1, 8, 9, 10]]);
|
|
365
377
|
}))
|
|
366
378
|
}, /*#__PURE__*/_react["default"].createElement(_reactNative.Text, {
|
|
367
379
|
style: _ImageCropperStyles["default"].buttonText
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-expo-cropper",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.32",
|
|
4
4
|
"description": "Recadrage polygonal d'images.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"author": "PCS AGRI",
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
"react-native-svg": "15.12.1",
|
|
31
31
|
"react-native-view-shot": "4.0.3"
|
|
32
32
|
},
|
|
33
|
+
"overrides": {
|
|
34
|
+
"glob": "^10.5.0"
|
|
35
|
+
},
|
|
33
36
|
"engines": {
|
|
34
37
|
"node": ">=14"
|
|
35
38
|
},
|
package/src/ImageCropper.js
CHANGED
|
@@ -243,8 +243,12 @@ const ImageCropper = ({ onConfirm, openCameraFirst, initialImage ,addheight}) =>
|
|
|
243
243
|
setIsLoading(true);
|
|
244
244
|
setShowResult(true);
|
|
245
245
|
try {
|
|
246
|
-
|
|
247
|
-
|
|
246
|
+
if(Platform.OS === 'android') {
|
|
247
|
+
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
248
|
+
}else{
|
|
249
|
+
// Wait for UI to render - give React time to update the SVG with white fill
|
|
250
|
+
await waitForRender(5);
|
|
251
|
+
}
|
|
248
252
|
|
|
249
253
|
console.log("Starting capture...");
|
|
250
254
|
const capturedUri = await captureRef(viewRef, {
|