How to get localUri of image after Image.prefetch?

Problem

I am trying to use React-Native’s Share API to share an image that was loaded into a conversation from a Amazon URI. Currently the Share api accepts a uri string. I can share the uri string, but would like to share the actual image by caching it locally and referencing the localUri in the Share API instead

Possible Solutions

  • Request and convert the hosted image into a base64 string and pass that in as a uri string to the Share API
  • Cache the image locally using Image.prefetch([uri]), and reference the locally cached file in the Share API
  • I tried doing this, but didn’t not receive any response after the image was cached

Your help/feedback is greatly appreciated it.

1 Like

I’d love to find a solution to this as well.

You can use FileSystem.downloadAsync instead of Image.prefetch if you want to have a local file uri: https://docs.expo.io/versions/latest/sdk/filesystem.html#expofilesystemdownloadasyncuri-fileuri-options