Last active
December 26, 2020 18:34
-
-
Save lil12t/84510c716d5a060583cc950a7ae0b576 to your computer and use it in GitHub Desktop.
[react-native-camera] [android] Slow barcode read fix
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Boosts up barcode read performance on Android | |
*/ | |
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} | |
/> | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment