@yudiel/react-qr-scanner
Version:
A library to scan QR codes in React.
39 lines • 2.11 kB
TypeScript
import type { BarcodeFormat } from 'barcode-detector';
import { type ReactNode } from 'react';
import type { IDetectedBarcode, IScannerClassNames, IScannerComponents, IScannerError, IScannerHandle, IScannerStyles, TrackFunction } from '../types';
export interface IScannerProps {
/** Called when one or more barcodes are detected. */
onScan: (detectedCodes: IDetectedBarcode[]) => void;
/** Called when the scanner can't start the camera or detection fails. */
onError?: (error: IScannerError) => void;
/** Media track constraints applied to the camera stream. */
constraints?: MediaTrackConstraints;
/** Barcode formats to detect. Defaults to all supported formats. */
formats?: BarcodeFormat[];
/** Pause the scanner and display a frozen frame of the last video frame. */
paused?: boolean;
/** Custom content to render over the scanner. */
children?: ReactNode;
/** Built-in UI components and tracker. Top-level `tracker` overrides `components.tracker`. */
components?: IScannerComponents;
/** Custom tracker overlay function. Convenience alias for `components.tracker`. */
tracker?: TrackFunction;
/** Inline CSS for the container and video. */
styles?: IScannerStyles;
/** Class names for the container and video. */
classNames?: IScannerClassNames;
/** Allow the same barcode to trigger `onScan` repeatedly. */
allowMultiple?: boolean;
/** Minimum delay (ms) between `onScan` calls when `allowMultiple` is true. */
scanDelay?: number;
/** Minimum delay (ms) between detection attempts. */
retryDelay?: number;
/** Play a beep on a successful scan, or a custom sound URL/data URI. */
sound?: boolean | string;
/** Max time (ms) to wait for the camera to start. Default 3000. */
startTimeoutMs?: number;
/** Delay (ms) after `play()` before reading capabilities. Default 500. */
settleDelayMs?: number;
}
export declare const Scanner: import("react").ForwardRefExoticComponent<IScannerProps & import("react").RefAttributes<IScannerHandle>>;
//# sourceMappingURL=Scanner.d.ts.map