簡體   English   中英

ReactImageView:圖像源“null”不存在 React-native

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

我正在制作一個 react-native 應用程序來打開相機並掃描條形碼/二維碼,我正在使用react-native-camera-kit並且我的項目工作正常,但是,當我打開相機時,我收到一條警告日志: 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)
        }
      />

您應該共享孔組件代碼來找出問題,但是當您使用類似以下內容時導致此問題的評論問題:

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

並且來自 state 的 ImageURI 還不存在。 使用條件來修復它,例如:

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM