Antonio Rodríguez
Antonio Rodríguez

Reputation: 135

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

Upvotes: 8

Views: 25576

Answers (2)

Hosam G. Zewain
Hosam G. Zewain

Reputation: 126

You should share the whole 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
}

Upvotes: 10

Chika Nwazuo Evuka
Chika Nwazuo Evuka

Reputation: 41

I think you are missing something maybe your image needs a URL, based on the pakage you are using to have access to camera or gallery just use this, E.g:

<Image style={userspoststyle.postimages}source={{uri:item.image}}/>

Upvotes: 0

Related Questions