So im using react-native-camera to scan barcodes in my app. But since i have upgraded my react native version it doesnt work anymore. It shows the error below :
Invariant Violation: requireNativeComponent: "RNCamera" was not found in the UIManager.
Here is the code and how i use it:
import { RNCamera } from 'react-native-camera';
const scanRef = createRef();
<RNCamera
key={'scan_camera'}
ref={scanRef}
style={styles.RNCamera}
type={RNCamera.Constants.Type.back}
playSoundOnCapture={true}
androidCameraPermissionOptions={{
title: 'Permission to use camera',
message: 'We need your permission to use your camera',
buttonPositive: 'Ok',
buttonNegative: 'Cancel',
}}
barCodeTypes={allowedBarcodeTypes}
onGoogleVisionBarcodesDetected={({ barcodes }) => {
if (barcodes.length) {
const barcode = barcodes[0];
const barcodeData = barcode.data;
// const barcodeType = barcode.type;
this.props.onBarCodeRead(barcodeData);
// close modal
closeModal();
}
}}
>
{
({ camera, status }) => {
if (status !== 'READY') return (<View style={styles.RNButtons}><Text>Loading...</Text></View>);
return (
<View style={styles.RNButtons}>
<TouchableOpacity style={[styles.RNButton, { backgroundColor: 'red' }]} onPress={() => closeModal()}>
<Text style={[styles.RNButtonText]}>{I18n.t('close').toUpperCase()}</Text>
</TouchableOpacity>
</View>
)
}
}
</RNCamera>
I've tried almost everything, installed the package manually acording to the doucmentation but with no luck.
My react version is "0.67.3"