react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

Camera is showing white screen instead of showing camera in android🐛

Open humza-reignsol opened this issue 3 years ago • 3 comments

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:

1646054120804

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

humza-reignsol avatar Feb 28 '22 13:02 humza-reignsol

Hmm, are you running the example app without making any modifications?

mrousavy avatar Feb 28 '22 13:02 mrousavy

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 :)

humza-reignsol avatar Feb 28 '22 14:02 humza-reignsol

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 🤔

nachoSource avatar Jul 22 '22 20:07 nachoSource

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.

Brittognanaraj avatar Feb 08 '23 09:02 Brittognanaraj

Ohh yea maybe the SurfaceView doesn't work then?

mrousavy avatar Feb 14 '23 15:02 mrousavy

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!

mrousavy avatar Aug 18 '23 16:08 mrousavy