Quantcast
Channel: Active questions tagged react-native+android - Stack Overflow
Viewing all articles
Browse latest Browse all 29892

React-native-camera appears as black screen

$
0
0

I'm trying to implement an eKYC for my application, which included 3 camera screens (2 screens with back side camera, 1 with front side camera)

On some Android devices (Samsung Note 8, Xiaomi Redmi Pro 8, Vsmart Joy 3, ...), the third screen's camera (front side camera) is not working (black screen).

I've tried to read the errors from Android logcat and I receive this error:

2021-01-11 12:29:00.704 3973-13086/com.******.vn W/CameraBase: An error occurred while connecting to camera 1: Status(-8): '8: connectHelper:1648: Too many cameras already open, cannot open camera "1"'

Things I've tried: use NavigationEvents and withNavigationFocus to render the camera when current screen is focused

const [isFocus, setFocus] = useState<boolean>(false)
<NavigationEvents onWillFocus={onFocus} onWillBlur={onBlur}></NavigationEvents>
{isFocus && props.isFocused && (<RNCamera      ref={refCamera}      style={styles.preview}      type={RNCamera.Constants.Type.front}      captureAudio={false}      onCameraReady={() => console.log('oncameraready')}      onFacesDetected={onFaceDetected}><View style={styles.progressBarContainer}><Progress.Bar          color={Colors.asEastOcean}          progress={progress}          width={200}          style={styles.progressBar}          borderColor={Colors.white}          unfilledColor={Colors.white}        /></View></RNCamera>  )}

But the camera on the third screen (front side camera) still not work. The other two work perfectly.Is there any way to fix this, thank you very much in advance!

Note: If I change the order and render the third screen first, the front side camera is working normally.


Viewing all articles
Browse latest Browse all 29892

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>