Camera is showing white screen instead of showing camera in android🐛
What were you trying to do?
when I loaded the camera screen it is just showing white blank page. if I resize camera, it start showing the actual camera screen but whenever I try to give width: ('Dimensions').width, height: ('Dimensions').height camera page is blank once again. Flash is working fine but don't know why camera page is showing white blank page. I'm attaching a screenshot below:
Reproduceable Code
<Reanimated.View style={StyleSheet.absoluteFill}>
<TapGestureHandler onEnded={onDoubleTap} numberOfTaps={2}>
<ReanimatedCamera
ref={camera}
style={StyleSheet.absoluteFill}
device={device}
format={format}
fps={fps}
hdr={enableHdr}
lowLightBoost={device.supportsLowLightBoost && enableNightMode}
isActive={isActive}
onInitialized={onInitialized}
onError={onError}
enableZoomGesture={false}
animatedProps={cameraAnimatedProps}
photo={true}
video={false}
audio={hasMicrophonePermission}
orientation="portrait"
/>
</TapGestureHandler>
</Reanimated.View>
What happened instead?
I have pasted the code I'm using. Kindly correct me if I'm wrong somewhere.
Relevant log output
No response
Device
OPPO F-19, Techno Camon16
VisionCamera Version
^2.12.1
Additional information
- [ ] I am using Expo
- [X] I have read the Troubleshooting Guide
- [X] I agree to follow this project's Code of Conduct
- [X] I searched for similar issues in this repository and found none.
Hmm, are you running the example app without making any modifications?
Hmm, are you running the example app without making any modifications?
Pardon, it was an issue on my side. I was trying to render camera in child view which caused this issue. Thanks for your acknowledgement :)
Hmm, are you running the example app without making any modifications?
Pardon, it was an issue on my side. I was trying to render camera in child view which caused this issue. Thanks for your acknowledgement :)
Well this is curious 😅 . Your answer helped me realise that Camera must be wrapped in <></> instead of a View component 🤔
Try this one android:hardwareAccelerated=false in AndroidManifest.xml makes the camera no longer display. Check your AndroidManifest and set it back to true may help the camera work again.
Ohh yea maybe the SurfaceView doesn't work then?
Hey! I've rewritten the entire Android codebase of VisionCamera from CameraX to Camera2 in the efforts of ✨ VisionCamera V3.
I just now completed the Camera2 rewrite and I believe the core structure is running, but there might be some edge cases to iron out. Can you try and test the PR #1674 for me to see if you can still reproduce this issue here?
Here's an instruction on how you can test that: https://github.com/mrousavy/react-native-vision-camera/pull/1674#issuecomment-1684104217
If the issue cannot be reproduced with that version/PR anymore, then hoorayy, I fixed it! 🎉 Otherwise please let me know and I'll keep this issue open to keep track of it.
Thank you!