-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
🐛 Application closes by itself after scanning a barcode. #2243
Comments
i have same issue..... |
I downgraded the package version to 3.6.6 but it didn't work. |
you can use 3.5.1 |
I found a temporary solution. Don't use any function that affects any interface inside the "onCodeScanned" function. Like "useState, useCallback, setXYZ, runOnJS". When I ran the process without using these functions, I noticed that it didn't give an error when reading the QR code. For now, the problem seems to be solved, the code quality of course decreases a bit. Can anyone else try this workaround?
|
@tahaipek can you please share more data? how can you
Isn't it the main purpose of |
Of course this is the task of the "onCodeScanned" function. But here there is an error when the QR code is read. I am looking for a permanent solution for this. For now, I have reached a temporary solution, even if it is bad. For now, I completed the development by removing the interface interactions. When the QR code is scanned, I showed a message on the screen with "Alert" and redirected the page. In the meantime, I realized that when the QR code is read, the application crashes as soon as I perform an operation that affects the UI in ReactNative. So I experimented by bypassing the elements that affect the UI one by one. I realized that there was no problem in using the native components of the phone, so I used "Alert". I tried this crash issue on Samsung S23, S23 Ultra and android emulator and so far no problem. If anyone tries differently, we can address the error more clearly. Since my knowledge of native application development is limited, I think the issue is caused by data sharing between threads, I am not sure and I do not want to mislead.
Temporary solution
|
I've been struggling with a similar issue for the last two days, cant get the source problem, but seems like navigating away from the camera while it hasnt properly stop triggers this type of crash. Seems like another way arround is to 'wait' for propper stop of the camera, so what I did was to use the code read to alter the 'isActive' property and then on the 'onStopped' prop of Camera instance fire the navigation/detection to another component. Here is an example.
|
+1 |
Same here Xiaomi Redmi Note 10, 3.6.16 |
Hey! Thanks for reporting this issue. I've been working the past days on making sure the Camera lifecycle is safely handled and released when needed to make sure this crash doesn't occur anymore. I just created a PR for this - can you please this to see if that fixes the issue for you? #2339 If this fixes your issue, please consider 💖 sponsoring me on GitHub 💖 to support me / thank me for building VisionCamera and continuously improving it. If this does not fix your issue, please clone the repo, check out the branch Thank you! 🙏 |
Still crashing with 3.7.0, initialization works much better though! My adb logcat looks pretty similar to the one from above :( I've let chatGPT analyze the logcat output:
|
Similar to #2341 (comment) I now know how I can prevent it from closing/crashing. I render the Camera component conditionally. The reason is the following: I have a bottom tab bar and I show the screen with the camera on one tab. But I also show the camera on another tab, when opening a modal (on this modal). To not have two Camera components open at the same time, I had to hide either. @mrousavy I hope that makes sense. This behaviour worked fine with v2. I get this error #2378 if I don't hide either. |
What's happening?
Hello, greetings to the great team you are, I have a problem using the library. It turns out that I implement it as indicated but I have problems after scanning a barcode the application simply quits completely. It can work fine for a few minutes scanning calmly and suddenly as if nothing comes out. Sorry if I'm not a programming veteran, I'm learning to use the library :D greetings and many thanks to the answers.
Reproduceable Code
Relevant log output
Camera Device
camara doble ancho
Device
redmi note 9s 4gb ram miui 14.0.4
VisionCamera Version
Can you reproduce this issue in the VisionCamera Example app?
Yes, I can reproduce the same issue in the Example app here
Additional information
The text was updated successfully, but these errors were encountered: