简体   繁体   中英

ReactImageView: Image source "null" doesn't exist React-native

I am making a react-native app to open the camera and scan barcodes/Qr codes, I'm using react-native-camera-kit and my project works fine, however, when I open the camera I get a warning log saying: ReactImageView: Image source "null" doesn't exist , I don't know why this occurs, some suggest?

this is my code:

 <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)
        }
      />

You should share the hole component code to figure out the issue but the comment problem that cause this when you use something like:

<Image source={{uri: **this.state.ImageURI**}} /> 

and the ImageURI from the state is not there yet. use a condition to fix it like:

{ this.state.ImageURI !== '' ? <Image source={this.state.ImageURI} /> :null
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM