0

after having a look around here and trying the two suggested solutions so far, I cannot seem to download, load and set an image as a state to be displayed in react native. Here's the code:

const dlResult = await downloadUrls(urls)
console.log (dlResult)
console.log ('here')
const picBlob = RNFetchBlob.fs.readFile(dlResult, 'base64')
let imageUri = "data:image/png;base64," + picBlob;
const newPics = []
newPics.push (imageUri)
setImages(newPics)

dlResult is just the path to the new image file. The "images" state is set to an array of four local static placeholder files. Once the picture is download, I want it to be shown as part of a new array. However, even though the app doesn't crash, the respective Image component shows an empty space, no pixels whatsoever. How can I fix this?

VictoriaStudios
  • 135
  • 1
  • 9

0 Answers0