【发布时间】:2018-09-27 13:20:22
【问题描述】:
我正在使用来自react-native-camera 的条形码扫描仪,目前如果我使用它并且有多个 QR 码紧密重叠,我将相机对准其中一个,它会读取其上方的代码屏幕上的显示,但在摄像机视图中。但是,如果我要扫描的那个上面没有 QR 码,那么它会扫描正确的那个,所以它似乎总是扫描相机视图中的顶部 QR 码。
这是我的问题:有没有办法将“扫描区域”限制为与显示器上的相机视图相同的大小和区域?
<View style={styles.container}>
<Camera
style={styles.preview}
onBarCodeRead={this.onBarCodeRead}
ref={cam => this.camera = cam}
aspect={Camera.constants.Aspect.fill}>
</Camera>
<Button
style={styles.buttonStyle}
<Text>{this.state.qrcode}</Text>
</Button>
</View>
const styles = {
container: {
height: 300,
flex: 1
},
preview: {
flex: 1
},
buttonStyle: {
marginTop: 20,
marginLeft: 20,
marginRight: 20,
marginBottom: 20,
alignSelf: 'center'
}
}
版本,如果需要:
"react-native": "0.42.3",
"react-native-camera": "0.6.0",
【问题讨论】:
-
您找到解决方法如何禁用屏蔽区域的扫描功能了吗?
标签: react-native camera qr-code barcode react-native-camera