teslamotors / react-native-camera-kit

A high performance, easy to use, rock solid camera library for React Native apps.
MIT License
2.46k stars 585 forks source link

Android camera stays black after permission is given #579

Open pavkatav opened 1 year ago

pavkatav commented 1 year ago

Describe the bug A clear and concise description of what the bug is. When on android, the camera component is rendered for the first time and asks for permission, and the user gives permission. Seems like the camera component is not updated and stays black, until the page is reloaded.

The same thing works on ios as expected. After the user gives permission, the camera is activated.

*To Reproduce

            <CameraScreen 
                cameraType={CameraType.Back}
                focusMode="on"
                actions={{ leftButtonText: 'Cancel' }}
                onBottomButtonPressed={() => navigation.goBack()}
                scanBarcode={true}
                onReadCode={(event) => onBarcodeScan(event.nativeEvent.codeStringValue)}
                showFrame={true}
                laserColor="transparent"
            />

Expected behavior When the user gives permission. The camera should turn on by itself, not needing a page/screen reload.

Iuriy-Budnikov commented 1 year ago

I have the same issue

pavkatav commented 1 year ago

The only workaround I came up with is checking if the user gave permission a few seconds after mounting the camera component 😞 .

Then reloading the component.

It is not very good but it is the only thing that is working.

Rajesh-bex commented 11 months ago

by asking the camera permissions before opening the camera resolved my issue.