-
Notifications
You must be signed in to change notification settings - Fork 409
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
fix(271): invalidate the ref in order to fix camera running in the background issue #279
base: master
Are you sure you want to change the base?
Conversation
Please merge this! |
@JodusNodus @JonatanSalas could you guys help push this along? |
@culda do you have another alternative to solve this issue? mine also running in the background |
@isneverdead this worked for me and I don't really plan to revisit |
okay then, i also have other solution like just refresh the page when the camera is closed, and the camera doesn't run in the background anymore 😅 i just running this for reload the app |
@isneverdead yeah screw the UX :) |
Please merge this change 👍 @isneverdead this thread is to fix the issue, the work is literally done, this isn't the right place to detract from the subject with a hacky way that barely solves the issue, most quality applications can't just reload after every QR scan. |
Won't be maintaining this but if anyone needs a temporary fix until this repo is maintained again I've deployed this package to npm. Kudos to @culda for solving the issue. https://www.npmjs.com/package/fork-react-qr-reader |
|
This isn't working for me. I uninstalled the other package and installed yours. Leaving everything as is, I get an error about the import. When I update the import to include "fork-react-qr-reader", the page renders. I get a new error related to the mounting state of the component. Can you provide any insight here? |
please merge this PR, I have the same problem on v.3 @JodusNodus |
You would indeed need to change it to |
it yells component is not mounted on my end tho |
It's not working while using with react strict mode turned on, because strict mode react makes two renders for a page, and the cleanup kills the video stream before the last render. |
Fix for #258
There is an issue in the following scenario:
decodeFromConstraints
is calledcontrolsRef.current
is falsy, thereforecontrolsRef.current.stop
doesn't rundecodeFromConstraints
resolves initialisingcontrolsRef
My solution improves the possible states the ref can be in, making sure that when the component is unmounted, the ref is actually invalidated.