问题描述
我想使用 react-native 在 IOS 中扫描 GS1 Databar Barcode,也称为 RSS Expanded 条码,我使用 react-native-qrcode-scanner https://github.com/moaazsidat/react-native-qrcode-scanner 来扫描条码。
<QRCodeScanner
onRead={this.onSuccess}
showMarker={true}
reactivate={false}
flashMode={RNCamera.Constants.FlashMode.auto}
topContent={
<View>
<Text>
Scan Coupon Barcode
</Text>
<Text>Please fit the barcode within the {'\n'} Box on the screen.</Text>
</View>
}
cameraStyle={styles.cameraContainer}
topViewStyle={styles.topcontainer}
bottomViewStyle={styles.zeroContainer}
markerStyle={styles.markerStyle}
containerStyle={styles.container}
/>
它在android中运行良好,但在IOS中无法选择条形码。在IOS二维码中,EAN-8条码被成功扫描,但GS1 Databar没有被扫描。
解决方法
没有找到使用 React-Native 在 iOS 上扫描 GS1 Databar Expanded 条码的高效开源解决方案。
尝试将 Zxingify-ObjC 作为本机模块,但在较新的 iPhone(11 Pro、12)上扫描效果不佳。
尝试了 react-native-barcode 插件。不支持使用相机扫描仪的 GS1 Databar 插件,但支持从静态图像扫描 GS1 Databar。
最终选择了付费 SDK:Cognex。
希望这对遇到同样问题的人有所帮助。