react-native-rectangle-doc-scanner 0.18.0 → 0.19.0

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.
@@ -230,8 +230,21 @@ const DocScanner = ({ onCapture, overlayColor = '#e7a649', autoCapture = true, m
230
230
  y: pt.y / ratio,
231
231
  }));
232
232
  // Skip convexity check for boundingRect (always forms a valid rectangle)
233
- if (!usedBoundingRect && !isConvexQuadrilateral(points)) {
234
- continue;
233
+ if (!usedBoundingRect) {
234
+ try {
235
+ if (!isConvexQuadrilateral(points)) {
236
+ if (__DEV__) {
237
+ console.log('[DocScanner] not convex, skipping:', points);
238
+ }
239
+ continue;
240
+ }
241
+ }
242
+ catch (err) {
243
+ if (__DEV__) {
244
+ console.warn('[DocScanner] convex check error:', err, 'points:', points);
245
+ }
246
+ continue;
247
+ }
235
248
  }
236
249
  if (area > maxArea) {
237
250
  best = points;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "repository": {
@@ -267,8 +267,20 @@ export const DocScanner: React.FC<Props> = ({
267
267
  }));
268
268
 
269
269
  // Skip convexity check for boundingRect (always forms a valid rectangle)
270
- if (!usedBoundingRect && !isConvexQuadrilateral(points)) {
271
- continue;
270
+ if (!usedBoundingRect) {
271
+ try {
272
+ if (!isConvexQuadrilateral(points)) {
273
+ if (__DEV__) {
274
+ console.log('[DocScanner] not convex, skipping:', points);
275
+ }
276
+ continue;
277
+ }
278
+ } catch (err) {
279
+ if (__DEV__) {
280
+ console.warn('[DocScanner] convex check error:', err, 'points:', points);
281
+ }
282
+ continue;
283
+ }
272
284
  }
273
285
 
274
286
  if (area > maxArea) {