React Native : Image source URI containing URL path of local image brought from API?

At Core, React Native support 2 types of images:

  1. Local Images: Image needs to be embedded with app at runtime using node’s require([asset_path]) and not work for a dynamic path.

  2. Networks Images. Those are images hosted to remote server and you reference them by Universal Resource Identifier (URI) and most time is valid HTTP or HTTPS resource link.

You’re trying to pass URI as a remote image which is an invalid (…/assets/images/subfolder/filename.ext) URI.

There are 2 ways you can solve this problem and both work well for Mobile and Web.

  1. Convert images to base64 and save encoded image string in database (Brute-force solution)

  2. Upload images to cloud providers like Amazon AWS or Firebase Storage and save respective public links in the database.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top