forked from moaazsidat/react-native-qrcode-scanner
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
95 lines (88 loc) · 2.44 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/* Type definitions for react-native-qrcode-scanner 1.1.0
* Definitions by: Jan Hesters <https://github.com/janhesters/>
* If you modify this file, put your GitHub info here as well (for easy contacting purposes)
*/
import { Component } from 'react';
import { ViewStyle, StyleProp } from 'react-native';
import { RNCameraProps } from 'react-native-camera';
type BarCodeType = Readonly<{
aztec: any;
code128: any;
code39: any;
code39mod43: any;
code93: any;
ean13: any;
ean8: any;
pdf417: any;
qr: any;
upce: any;
interleaved2of5: any;
itf14: any;
datamatrix: any;
}>;
interface Point<T = number> {
x: T;
y: T;
}
interface Size<T = number> {
width: T;
height: T;
}
export interface Event {
data: any;
type: keyof BarCodeType;
/**
* @description For Android use `[Point<string>, Point<string>]`
* @description For iOS use `{ origin: Point<string>, size: Size<string> }`
*/
bounds:
| [Point<string>, Point<string>]
| { origin: Point<string>; size: Size<string> };
}
export interface RNQRCodeScannerProps {
onRead(e: Event): void;
vibrate?: boolean;
reactivate?: boolean;
reactivateTimeout?: number;
fadeIn?: boolean;
showMarker?: boolean;
cameraType?: 'front' | 'back';
customMarker?: JSX.Element;
containerStyle?: StyleProp<ViewStyle>;
cameraStyle?: StyleProp<ViewStyle>;
markerStyle?: StyleProp<ViewStyle>;
topViewStyle?: StyleProp<ViewStyle>;
bottomViewStyle?: StyleProp<ViewStyle>;
topContent?: JSX.Element | string;
bottomContent?: JSX.Element | string;
notAuthorizedView?: JSX.Element;
permissionDialogTitle?: string;
permissionDialogMessage?: string;
buttonPositive?: string;
checkAndroid6Permissions?: boolean;
cameraProps?: RNCameraProps;
cameraTimeout?: number;
cameraTimeoutView?: JSX.Element;
}
export interface RNQRCodeScannerState {
readonly scanning: boolean;
readonly fadeInOpacity: any;
readonly isAuthorized: boolean;
readonly isAuthorizationChecked: boolean;
readonly disableVibrationByUser: boolean;
}
export default class QRCodeScanner extends Component<
RNQRCodeScannerProps,
RNQRCodeScannerState
> {
disable(): void;
enable(): void;
_setScanning(value: boolean): void;
_handleBarCodeRead(e: Event): void;
_renderTopContent(): JSX.Element | null;
_renderBottomContent(): JSX.Element | null;
_renderCameraMarker(): JSX.Element | null;
_renderCameraComponent(): JSX.Element | null;
_renderCamera(): JSX.Element;
reactivate(): void;
}