Skip to content

Commit f1a512a

Browse files
committed
fix: remove mandatory ts fields
1 parent 7ab9615 commit f1a512a

File tree

2 files changed

+55
-23
lines changed

2 files changed

+55
-23
lines changed

README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ If you do not have it already in your project, you must link openCV in your `set
4646

4747
```java
4848
include ':openCVLibrary310'
49-
project(':openCVLibrary310').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-document-scanner/android/openCVLibrary310')
49+
project(':openCVLibrary310').projectDir = new File(rootProject.projectDir,'../node_modules/@woonivers/react-native-document-scanner/android/openCVLibrary310')
5050
```
5151

5252
#### In android/app/src/main/AndroidManifest.xml
@@ -72,10 +72,10 @@ Add Camera permissions request:
7272
## Usage
7373

7474
```javascript
75-
import React, { Component } from "react";
76-
import { View, Image } from "react-native";
75+
import React, { Component } from "react"
76+
import { View, Image } from "react-native"
7777

78-
import DocumentScanner from "react-native-document-scanner";
78+
import DocumentScanner from "react-native-document-scanner"
7979

8080
class YourComponent extends Component {
8181
render() {
@@ -88,7 +88,7 @@ class YourComponent extends Component {
8888
this.setState({
8989
image: data.croppedImage,
9090
initialImage: data.initialImage,
91-
rectangleCoordinates: data.rectangleCoordinates
91+
rectangleCoordinates: data.rectangleCoordinates,
9292
})
9393
}
9494
overlayColor="rgba(255,130,0, 0.7)"
@@ -108,7 +108,7 @@ class YourComponent extends Component {
108108
resizeMode="contain"
109109
/>
110110
</View>
111-
);
111+
)
112112
}
113113
}
114114
```
@@ -142,7 +142,7 @@ class YourComponent extends Component {
142142
- Then call :
143143

144144
```javascript
145-
this.scanner.capture();
145+
this.scanner.capture()
146146
```
147147

148148
## Each rectangle detection (iOS only)

src/index.tsx

Lines changed: 48 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,57 @@
11
import React from 'react'
2-
import { DeviceEventEmitter, NativeModules, Platform, requireNativeComponent } from 'react-native'
2+
import {
3+
DeviceEventEmitter,
4+
NativeModules,
5+
Platform,
6+
requireNativeComponent,
7+
ViewStyle
8+
} from 'react-native'
39

410
const RNPdfScanner = requireNativeComponent('RNPdfScanner')
511
const CameraManager = NativeModules.RNPdfScannerManager || {}
612

13+
export interface PictureTaken {
14+
rectangleCoordinates?: object;
15+
croppedImage: string;
16+
initialImage: string;
17+
width: number;
18+
height: number;
19+
}
20+
21+
/**
22+
* TODO: Change to something like this
23+
interface PictureTaken {
24+
uri: string;
25+
base64?: string;
26+
width?: number; // modify to get it
27+
height?: number; // modify to get it
28+
rectangleCoordinates?: object;
29+
initial: {
30+
uri: string;
31+
base64?: string;
32+
width: number; // modify to get it
33+
height: number; // modify to get it
34+
};
35+
}
36+
*/
37+
738
interface PdfScannerProps {
8-
onPictureTaken: (event: any) => void;
9-
onRectangleDetect: (event: any) => void;
10-
onProcessing: () => void;
11-
quality: number;
12-
overlayColor: number | string;
13-
enableTorch: boolean;
14-
useFrontCam: boolean;
15-
saturation: number;
16-
brightness: number;
17-
contrast: number;
18-
detectionCountBeforeCapture: number;
19-
detectionRefreshRateInMS: number;
20-
documentAnimation: boolean;
21-
noGrayScale: boolean;
22-
manualOnly: boolean;
39+
onPictureTaken?: (event: any) => void;
40+
onRectangleDetect?: (event: any) => void;
41+
onProcessing?: () => void;
42+
quality?: number;
43+
overlayColor?: number | string;
44+
enableTorch?: boolean;
45+
useFrontCam?: boolean;
46+
saturation?: number;
47+
brightness?: number;
48+
contrast?: number;
49+
detectionCountBeforeCapture?: number;
50+
detectionRefreshRateInMS?: number;
51+
documentAnimation?: boolean;
52+
noGrayScale?: boolean;
53+
manualOnly?: boolean;
54+
style?: ViewStyle;
2355
}
2456

2557
class PdfScanner extends React.Component<PdfScannerProps> {

0 commit comments

Comments
 (0)