-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
2.0b3 continuous scanning even when using with default settings #33
Comments
Same here! Please teach me how to fix it? |
I have similar issues: the Scanner continues scanning even when component got unmounted (routing away). useEffect(() => {
return stopScanning;
}, []) something like that This is case where the ref to the scanner should be forwarded and maybe even an useImperativeHandle should be used, to pass more fine-grained control to the dev |
I finally downgraded to V1... btw: the export const useCameraDevices = () => {
const {
data,
isLoading,
error
} = useSWR("detectCameraDevices", async () => {
if(isBrowser){
const devices = await navigator.mediaDevices.enumerateDevices();
return devices.filter(({kind}) => kind === "videoinput");
}
return []
})
return {
devices: data ?? [],
isLoading: isLoading,
error
}
}
|
We can confirm that the bug can happen anytime, after seconds, minutes or hours. |
Are there any ideas on how to fix this? |
It could be tied to https://github.com/zxing-js/library which is used as dependency, which btw looks in maintenance mode only and has these issues open |
I don't know if it "fixes" any issues behind the scenes but I've added a timeout, after i've collected a scan result, before I collapse (delete) the component. It appears to have "fixed" this. (It no longer makes beeping noises, and appears to be off).
|
We experienced similar issues. We solved it by enabling the scanner in function App() {
const navigate = useNavigate();
const [enabled, setEnabled] = useState<boolean>(false);
useEffect(() => {
setEnabled(true);
}, []);
return (
<LayOut>
<Scanner
onResult={(text) => {
setEnabled(false);
// DO ACTION
navigate(`/code/${code}`);
}}
onError={(error) => console.error(error)}
enabled={enabled}
/>
<div id="scanner-video"></div>
</LayOut>
);
}
export default App; |
This issue should be fixed on |
Hi
I recently did a yarn upgrade-interactive and for some unknown reason I got the 2.0 version proposed. Anyway, when running it via the following (what I consider to be the default component integration):
I do get continuous scanning even though I no longer show a QR code to the camera (so I hear a loud beep every 1s or so).
The text was updated successfully, but these errors were encountered: