Ant*_*uez 7 barcode-scanner react-native
我正在制作一个反应本机应用程序来打开相机并扫描条形码/二维码,我正在使用反应本机相机套件,我的项目工作正常,但是,当我打开相机时,我收到一条警告日志:ReactImageView:图像源“null”不存在,我不知道为什么会发生这种情况,有人建议?
这是我的代码:
<CameraScreen
showFrame={true}
// Show/hide scan frame
scanBarcode={true}
// Can restrict for the QR Code only
laserColor={'red'}
// Color can be of your choice
frameColor={'red'}
// If frame is visible then frame color
colorForScannerFrame={'black'}
// Scanner Frame color
onReadCode={(event) =>
onBarcodeScan(event.nativeEvent.codeStringValue)
}
/>
Run Code Online (Sandbox Code Playgroud)
小智 7
您应该共享孔组件代码来找出问题,但是当您使用以下内容时会导致此问题的注释问题:
<Image source={{uri: **this.state.ImageURI**}} />
Run Code Online (Sandbox Code Playgroud)
并且来自该状态的 ImageURI 还不存在。使用条件来修复它,例如:
{ this.state.ImageURI !== '' ? <Image source={this.state.ImageURI} /> :null
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
15813 次 |
| 最近记录: |