react-native-rectangle-doc-scanner 3.79.0 → 3.80.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.
@@ -1,5 +1,5 @@
1
1
  import React, { ReactNode } from 'react';
2
- import type { Rectangle as NativeRectangle, RectangleEventPayload } from 'react-native-document-scanner';
2
+ import type { Rectangle as NativeRectangle, RectangleEventPayload } from '../vendor/react-native-document-scanner';
3
3
  import type { Point, Rectangle } from './types';
4
4
  type PictureEvent = {
5
5
  croppedImage?: string | null;
@@ -39,7 +39,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
39
39
  exports.DocScanner = void 0;
40
40
  const react_1 = __importStar(require("react"));
41
41
  const react_native_1 = require("react-native");
42
- const react_native_document_scanner_1 = __importDefault(require("react-native-document-scanner"));
42
+ const react_native_document_scanner_1 = __importDefault(require("../vendor/react-native-document-scanner"));
43
43
  const coordinate_1 = require("./utils/coordinate");
44
44
  const overlay_1 = require("./utils/overlay");
45
45
  const isFiniteNumber = (value) => typeof value === 'number' && Number.isFinite(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-rectangle-doc-scanner",
3
- "version": "3.79.0",
3
+ "version": "3.80.0",
4
4
  "description": "Native-backed document scanner for React Native with customizable overlays.",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -42,8 +42,5 @@
42
42
  "react-native-image-picker": "^7.1.2",
43
43
  "react-native-image-crop-picker": "^0.41.2",
44
44
  "typescript": "^5.3.3"
45
- },
46
- "dependencies": {
47
- "react-native-document-scanner": "github:Michaelvilleneuve/react-native-document-scanner"
48
45
  }
49
46
  }
@@ -16,8 +16,8 @@ import {
16
16
  NativeModules,
17
17
  findNodeHandle,
18
18
  } from 'react-native';
19
- import DocumentScanner from 'react-native-document-scanner';
20
- import type { Rectangle as NativeRectangle, RectangleEventPayload } from 'react-native-document-scanner';
19
+ import DocumentScanner from '../vendor/react-native-document-scanner';
20
+ import type { Rectangle as NativeRectangle, RectangleEventPayload } from '../vendor/react-native-document-scanner';
21
21
  import { rectangleToQuad } from './utils/coordinate';
22
22
  import type { Point, Rectangle } from './types';
23
23
  import { ScannerOverlay } from './utils/overlay';
package/src/external.d.ts CHANGED
@@ -84,6 +84,12 @@ declare module 'react-native-document-scanner' {
84
84
  }
85
85
  }
86
86
 
87
+ declare module '../vendor/react-native-document-scanner' {
88
+ import DocumentScanner from 'react-native-document-scanner';
89
+ export * from 'react-native-document-scanner';
90
+ export default DocumentScanner;
91
+ }
92
+
87
93
  declare module 'react-native-svg' {
88
94
  import type { ComponentType, ReactNode } from 'react';
89
95
 
package/tsconfig.json CHANGED
@@ -9,5 +9,5 @@
9
9
  "outDir": "dist",
10
10
  "declaration": true
11
11
  },
12
- "include": ["src"]
12
+ "include": ["src", "vendor/**/*.d.ts"]
13
13
  }
@@ -0,0 +1,56 @@
1
+ import type { Component } from 'react';
2
+ import type { ViewStyle } from 'react-native';
3
+
4
+ export type RectanglePoint = {
5
+ x: number;
6
+ y: number;
7
+ };
8
+
9
+ export type Rectangle = {
10
+ topLeft: RectanglePoint;
11
+ topRight: RectanglePoint;
12
+ bottomLeft: RectanglePoint;
13
+ bottomRight: RectanglePoint;
14
+ };
15
+
16
+ export type RectangleEventPayload = {
17
+ stableCounter: number;
18
+ lastDetectionType: number;
19
+ rectangleCoordinates?: Rectangle | null;
20
+ rectangleOnScreen?: Rectangle | null;
21
+ previewSize?: { width: number; height: number };
22
+ imageSize?: { width: number; height: number };
23
+ };
24
+
25
+ export type DocumentScannerResult = {
26
+ croppedImage?: string | null;
27
+ initialImage?: string | null;
28
+ width?: number;
29
+ height?: number;
30
+ rectangleCoordinates?: Rectangle | null;
31
+ };
32
+
33
+ export interface DocumentScannerProps {
34
+ style?: ViewStyle;
35
+ detectionCountBeforeCapture?: number;
36
+ overlayColor?: string;
37
+ enableTorch?: boolean;
38
+ useBase64?: boolean;
39
+ quality?: number;
40
+ manualOnly?: boolean;
41
+ detectionConfig?: {
42
+ processingWidth?: number;
43
+ cannyLowThreshold?: number;
44
+ cannyHighThreshold?: number;
45
+ snapDistance?: number;
46
+ maxAnchorMisses?: number;
47
+ maxCenterDelta?: number;
48
+ };
49
+ onPictureTaken?: (event: DocumentScannerResult) => void;
50
+ onError?: (error: Error) => void;
51
+ onRectangleDetect?: (event: RectangleEventPayload) => void;
52
+ }
53
+
54
+ export default class DocumentScanner extends Component<DocumentScannerProps> {
55
+ capture(): Promise<DocumentScannerResult>;
56
+ }