1import { PermissionResponse, PermissionStatus, PermissionHookOptions } from 'expo-modules-core';
2import * as React from 'react';
3import { ViewProps } from 'react-native';
4/**
5 * Those coordinates are represented in the coordinate space of the barcode source (e.g. when you
6 * are using the barcode scanner view, these values are adjusted to the dimensions of the view).
7 */
8export type BarCodePoint = {
9    /**
10     * The `x` coordinate value.
11     */
12    x: number;
13    /**
14     * The `y` coordinate value.
15     */
16    y: number;
17};
18export type BarCodeSize = {
19    /**
20     * The height value.
21     */
22    height: number;
23    /**
24     * The width value.
25     */
26    width: number;
27};
28export type BarCodeBounds = {
29    /**
30     * The origin point of the bounding box.
31     */
32    origin: BarCodePoint;
33    /**
34     * The size of the bounding box.
35     */
36    size: BarCodeSize;
37};
38export type BarCodeScannerResult = {
39    /**
40     * The barcode type.
41     */
42    type: string;
43    /**
44     * The information encoded in the bar code.
45     */
46    data: string;
47    /**
48     * The [BarCodeBounds](#barcodebounds) object.
49     * `bounds` in some case will be representing an empty rectangle.
50     * Moreover, `bounds` doesn't have to bound the whole barcode.
51     * For some types, they will represent the area used by the scanner.
52     */
53    bounds: BarCodeBounds;
54    /**
55     * Corner points of the bounding box.
56     * `cornerPoints` is not always available and may be empty. On iOS, for `code39` and `pdf417`
57     * you don't get this value.
58     */
59    cornerPoints: BarCodePoint[];
60};
61export type BarCodeEvent = BarCodeScannerResult & {
62    target?: number;
63};
64export type BarCodeEventCallbackArguments = {
65    nativeEvent: BarCodeEvent;
66};
67export type BarCodeScannedCallback = (params: BarCodeEvent) => void;
68export type BarCodeScannerProps = ViewProps & {
69    /**
70     * Camera facing. Use one of `BarCodeScanner.Constants.Type`. Use either `Type.front` or `Type.back`.
71     * Same as `Camera.Constants.Type`.
72     * @default Type.back
73     */
74    type?: 'front' | 'back' | number;
75    /**
76     * An array of bar code types. Usage: `BarCodeScanner.Constants.BarCodeType.<codeType>` where
77     * `codeType` is one of these [listed above](#supported-formats). Defaults to all supported bar
78     * code types. It is recommended to provide only the bar code formats you expect to scan to
79     * minimize battery usage.
80     *
81     * For example: `barCodeTypes={[BarCodeScanner.Constants.BarCodeType.qr]}`.
82     */
83    barCodeTypes?: string[];
84    /**
85     * A callback that is invoked when a bar code has been successfully scanned. The callback is
86     * provided with an [BarCodeScannerResult](#barcodescannerresult).
87     * > __Note:__ Passing `undefined` to the `onBarCodeScanned` prop will result in no scanning. This
88     * > can be used to effectively "pause" the scanner so that it doesn't continually scan even after
89     * > data has been retrieved.
90     */
91    onBarCodeScanned?: BarCodeScannedCallback;
92};
93export declare class BarCodeScanner extends React.Component<BarCodeScannerProps> {
94    lastEvents: {
95        [key: string]: any;
96    };
97    lastEventsTimes: {
98        [key: string]: any;
99    };
100    static Constants: {
101        BarCodeType: any;
102        Type: any;
103    };
104    static ConversionTables: {
105        type: any;
106    };
107    static defaultProps: {
108        type: any;
109        barCodeTypes: unknown[];
110    };
111    /**
112     * Checks user's permissions for accessing the camera.
113     * @return Return a promise that fulfills to an object of type [`PermissionResponse`](#permissionresponse).
114     */
115    static getPermissionsAsync(): Promise<PermissionResponse>;
116    /**
117     * Asks the user to grant permissions for accessing the camera.
118     *
119     * On iOS this will require apps to specify the `NSCameraUsageDescription` entry in the `Info.plist`.
120     * @return Return a promise that fulfills to an object of type [`PermissionResponse`](#permissionresponse).
121     */
122    static requestPermissionsAsync(): Promise<PermissionResponse>;
123    /**
124     * Check or request permissions for the barcode scanner.
125     * This uses both `requestPermissionAsync` and `getPermissionsAsync` to interact with the permissions.
126     *
127     * @example
128     * ```ts
129     * const [permissionResponse, requestPermission] = BarCodeScanner.usePermissions();
130     * ```
131     */
132    static usePermissions: (options?: PermissionHookOptions<object> | undefined) => [PermissionResponse | null, () => Promise<PermissionResponse>, () => Promise<PermissionResponse>];
133    /**
134     * Scan bar codes from the image given by the URL.
135     * @param url URL to get the image from.
136     * @param barCodeTypes An array of bar code types. Defaults to all supported bar code types on
137     * the platform.
138     * > __Note:__ Only QR codes are supported on iOS.
139     * @return A possibly empty array of objects of the `BarCodeScannerResult` shape, where the type
140     * refers to the bar code type that was scanned and the data is the information encoded in the bar
141     * code.
142     */
143    static scanFromURLAsync(url: string, barCodeTypes?: string[]): Promise<BarCodeScannerResult[]>;
144    render(): JSX.Element;
145    /**
146     * @hidden
147     */
148    onObjectDetected: (callback?: BarCodeScannedCallback) => ({ nativeEvent }: BarCodeEventCallbackArguments) => void;
149    /**
150     * @hidden
151     */
152    convertNativeProps(props: BarCodeScannerProps): BarCodeScannerProps;
153}
154export { PermissionResponse, PermissionStatus, PermissionHookOptions };
155export declare const Constants: {
156    BarCodeType: any;
157    Type: any;
158}, getPermissionsAsync: typeof BarCodeScanner.getPermissionsAsync, requestPermissionsAsync: typeof BarCodeScanner.requestPermissionsAsync, scanFromURLAsync: typeof BarCodeScanner.scanFromURLAsync;
159//# sourceMappingURL=BarCodeScanner.d.ts.map