提问人:BluDecoder 提问时间:6/21/2023 更新时间:6/21/2023 访问量:245
如何限制 react-native expo App 中的扫描区域?
How to limit Scanning area within an react-native expo App?
问:
我正在开发一个移动应用程序,它应该能够扫描各种条形码和二维码。 为此,我将expo-barcode-scanner与react-native-barcode-mask结合使用。 问题在于,用户应该能够从条形码列表中扫描一个条形码,并正确地知道该应用程序可以识别屏幕上的任何条形码。条形码是在口罩内还是在口罩外都无关紧要。
我尝试使用不同的插件,例如 react-native-camera 或 react-native-camera-kit。其中包含用于限制扫描仪尝试读取的区域的函数。可悲的是,他们要么老了,要么就是这些选择不起作用。 下面是我如何实现扫描仪的简短示例。
</View>
<BarCodeScanner onBarCodeScanned={handleBarCodeScanned} style={StyleSheet.absoluteFillObject}>
<BarcodeMask edgeColor="red" animatedLineColor="red" showAnimatedLine />
<View style={{ alignItems: "flex-end" }}>
<TouchableOpacity
onPress={() => {
setCamera(false);
}}
style={{
width: 50,
height: 50,
justifyContent: "center",
alignItems: "center",
padding: 2,
borderRadius: 100,
backgroundColor: "rgb(0,0,0,0)",
marginRight: 10,
}}
>
<Icon name="close-circle-outline" size={40} type="material-community" color="white" />
</TouchableOpacity>
</View>
</BarCodeScanner>
</View>
我还没有找到最新且有效的解决方案。 有谁知道或知道如何将区域限制为较小的矩形?
答: 暂无答案
评论