Skip to content

Commit

Permalink
Fix: unable to scan the long barcodes on mobile devices (#82)
Browse files Browse the repository at this point in the history
* fix: unable to scan the long barcodes on mobile devices

* fix: reduce too many requests in the scanning app
  • Loading branch information
huynguyen-hl authored Jul 15, 2024
1 parent 205e04a commit 93d1859
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions packages/mock-app/src/components/Scanner/Scanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ const Scanner = forwardRef((props: IHtml5QrcodePluginProps, ref: ForwardedRef<IS
fps: props.fps || 10,
qrbox: props.qrbox || { width: 250, height: 150 },
disableFlip: props.disableFlip || false,
useBarCodeDetectorIfSupported: props.useBarCodeDetectorIfSupported || true,
focusMode: props.focusMode || 'continuous'
}), [props.fps, props.qrbox, props.disableFlip]);

/**
Expand Down
6 changes: 4 additions & 2 deletions packages/mock-app/src/pages/Scanning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const Scanning = () => {
};

React.useEffect(() => {
if (!scannedCode || !identityProvider) {
if (!scannedCode || !identityProvider || isLoading) {
return;
}

Expand Down Expand Up @@ -92,8 +92,10 @@ const Scanning = () => {
<Scanner
ref={scannerRef}
fps={30}
qrbox={{ width: 250, height: 150 }}
qrbox={{ width: 500, height: 300 }}
disableFlip={false}
useBarCodeDetectorIfSupported={true}
focusMode= 'continuous'
qrCodeSuccessCallback={onScanResult}
qrCodeErrorCallback={onScanError}
/>
Expand Down
2 changes: 2 additions & 0 deletions packages/mock-app/src/types/scanner.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export interface IHtml5QrcodePluginProps {
qrbox?: { width: number; height: number };
aspectRatio?: number;
disableFlip?: boolean;
useBarCodeDetectorIfSupported?: boolean;
focusMode?: string;
qrCodeSuccessCallback: (decodedText: string, result: Html5QrcodeResult) => void;
qrCodeErrorCallback?: (error: unknown) => void;
};
Expand Down

0 comments on commit 93d1859

Please sign in to comment.