Reputation: 99
Scanning on Android is not working as intended, or it takes time to scan
3 different libraries i Have used: zxy firebase-ml-vision Google vision
Config is:: react-native-cli: 2.0.1 react-native: 0.62.2 "react-native-camera": "3.37.0"
Upvotes: 1
Views: 1710
Reputation: 3067
A solution from 2022:
Upvotes: 0
Reputation: 311
/**
* Boosts up barcode read performance on Android
*/
import { RNCamera, RNCameraProps } from 'react-native-camera';
const RNCameraProps: RNCameraProps = {};
if (Platform.OS === OS.IOS) {
RNCameraProps.onBarCodeRead = ({ data }) => {
console.log(data);
};
} else {
RNCameraProps.onGoogleVisionBarcodesDetected = ({ barcodes }) => {
const response = barcodes[0];
console.log(response);
};
}
return(
<RNCamera
type={RNCamera.Constants.Type.back}
style={styles.camera}
{...RNCameraProps}
/>
);
Upvotes: 1