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.
@@ -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 waitForRender(5);
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 = 3;
335
+ _context2.n = 5;
324
336
  return (0, _reactNativeViewShot.captureRef)(viewRef, {
325
337
  format: 'png',
326
338
  quality: 1
327
339
  });
328
- case 3:
340
+ case 5:
329
341
  capturedUri = _context2.v;
330
342
  console.log("Capture successful:", capturedUri);
331
343
  if (capturedUri) {
332
- _context2.n = 4;
344
+ _context2.n = 6;
333
345
  break;
334
346
  }
335
347
  throw new Error("Capture returned empty URI");
336
- case 4:
348
+ case 6:
337
349
  console.log("Enhancing image...");
338
- _context2.n = 5;
350
+ _context2.n = 7;
339
351
  return (0, _ImageProcessor.enhanceImage)(capturedUri, addheight);
340
- case 5:
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 = 7;
360
+ _context2.n = 9;
349
361
  break;
350
- case 6:
351
- _context2.p = 6;
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 7:
356
- _context2.p = 7;
367
+ case 9:
368
+ _context2.p = 9;
357
369
  setShowResult(false);
358
370
  setIsLoading(false);
359
371
  setShowFullScreenCapture(false);
360
- return _context2.f(7);
361
- case 8:
372
+ return _context2.f(9);
373
+ case 10:
362
374
  return _context2.a(2);
363
375
  }
364
- }, _callee2, null, [[1, 6, 7, 8]]);
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.31",
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
  },
@@ -243,8 +243,12 @@ const ImageCropper = ({ onConfirm, openCameraFirst, initialImage ,addheight}) =>
243
243
  setIsLoading(true);
244
244
  setShowResult(true);
245
245
  try {
246
- // Wait for UI to render - give React time to update the SVG with white fill
247
- await waitForRender(5);
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, {