-
-
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
🐛 <Camera> is located at top left corner on its first start - while it is expected at the center of the window #3237
Comments
Guten Tag, Hans here. Thank you for your detailed report! It looks like you are experiencing a valid issue with the component not starting in the expected position. However, I noticed that you didn’t try to reproduce this issue in the VisionCamera Example app. This is important for us to understand if it is an issue specific to your app or a potential bug in the library itself. Please give it a try and let us know the results. Also, if you could provide more logs surrounding the initialization process or any errors you might see, it would greatly help mrousavy in diagnosing the issue further. You can gather them by running Feel free to follow up after trying the example app. Cheers! 🍻
|
I have just tried VisionCamera Example app. The application is in full screen. I did modify the example app to be closer to my case and it seems to work (ie: the is always in the middle of the screen):
But the VisionCamera Example app is much more complex than my test app. I do not know whether I missed something. cc: @mrousavy |
I have been trying to reduce VisionCamera Example app code to simpler test app. I managed few times to duplicate the issue with a minimal version of VisionCamera Example app but not as often as with my app. I would guess it is a timing / race condition issue somewhere in For my test app, I used latest react-native and I have enabled new react native architecture. |
I'm having the same problem that the layout is set wrong occasionally (around 20% of the time) there is some race issue going on.. |
I had on camera view component const device = useCameraDevice('back'); useEffect(() => { if(!hasCameraRight) if (!device) { After I removed that hasCameraRights check it started working correctly, so it has something to do with layout change timings. |
I am also experiencing this. I am on RN I was attempting to get the camera to sit below a header but I was experiencing this exact problem where the camera pops to the top left. This only happened on android, a Pixel 3a API 33 for me, and didnt happen every single time but it would happen 1 in 10 renders of the camera. I created a very very simple test project on RN Reproducible code -> https://github.com/FraserKemp/CameraReproduceCase Again I tested on Pixel 3a API 33. |
I did not test your code, but it's similar when I had problems. I'm sure if you take that rights check away it will work. In my case I removed the right check and added it outside to the camera open event before initializing the component. You could also add some right check wrapper and only initialize the camera component after have rights. |
I just found some strange... workaround?
After some hours of debugging, I added UPD 1: It looks like |
I was experiencing the same issue. This was only happening on initial render. |
I am also experiencing something similiar, I have a button that open the camera for scanning in place, getting this: While it should be: Above hack with using UPDATE:
|
What's happening?
In my simple app, the first time I start it, the is located at the top left corner of the screen while I expect it to be in the middle of the screen.
But when coming back on the screen, the is now located in the middle of the screen.
What I see:
On the screen reload:
Reproduceable Code
Relevant log output
Camera Device
Device
Samsung Galaxy A20e (Android 11)
VisionCamera Version
4.5.3
Can you reproduce this issue in the VisionCamera Example app?
I didn't try (⚠️ your issue might get ignored & closed if you don't try this)
Additional information
The text was updated successfully, but these errors were encountered: