Open ZAT90 opened 1 year ago
have tried with latest version 1.5.5, still the same. Any idea @moaazsidat ?
When scanning a QR code, it keeps on repeating the scan process. As a result, it keeps giving the same result multiple times as well and keep on vibrating.
What's happening?
When scanning a QR code, if the camera is kept pointed at the qr code, it keeps on scanning for multiple times
How can it be reproduced?
Keep the camera pointed at a specific QR code and do not move the phone
Build details?
1.4.1
Hi, I have a possible solution for this issue. You can use a debounce function to limit the number of calls to the onBarCodeRead method and Please let me know if it solves your problem. Here is the code:
// Import debounce from lodash
import debounce from 'lodash.debounce';
// Define your onBarCodeRead function
const onBarCodeRead = (event) => {
// Do something with the event object
console.log(event.type, event.data);
};
// Define a debounced version of your onBarCodeRead function using React.useCallback hook
const debouncedOnBarCodeRead = React.useCallback(debounce(onBarCodeRead, 1000), []);
// Pass the debouncedOnBarCodeRead function as a prop to the QRCodeScanner component
<QRCodeScanner onBarCodeRead={debouncedOnBarCodeRead} />```
When scanning a QR code, it keeps on repeating the scan process. As a result, it keeps giving the same result multiple times as well and keep on vibrating.
What's happening?
When scanning a QR code, if the camera is kept pointed at the qr code, it keeps on scanning for multiple times
How can it be reproduced?
Keep the camera pointed at a specific QR code and do not move the phone
Build details?
1.4.1