question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is it possible to have <img>s with local URIs?

See original GitHub issue

Does react-native-htmlview support <img> tags with images local to the project?

I can’t seem to get it to work with any path, even when they work as expected when passing them to a RN <Image> element.

So this works:

<Image source={require('../Images/logo.png')}>

but this doesn’t:

 const htmlContent = `<img src="../Images/logo.png">`;
 <HTMLView value={htmlContent} />

I’m getting

Failed to get size for image: …/Images/logo.png

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:3
  • Comments:5

github_iconTop GitHub Comments

2reactions
richchurchercommented, Jul 22, 2017

@pekkanikolaus at the moment it’s assumed that the resource is remote: the { uri: ... } object is passed to the underlying Image component. That should be a fairly easy fix, so if you’d like to PR it feel free! Otherwise it’ll join the ‘nice to have’ feature list 😉

0reactions
KVinScommented, May 17, 2020

I used a similar path:

file:///data/user/0/com.sugoireader/files/gSmWCJF.png

But the image is too blurry 2020-05-17_06-39-56

Read more comments on GitHub >

github_iconTop Results From Across the Web

Embedding Local Images using Data URIs - SpiceLogic
In order to keep your inserted images, you can embed them using Base64 Data URI. Base64 Data URI allows you to get rid...
Read more >
android - React Native - How to load local image using the uri ...
It works for network images but it doesn't work for local images and even it does not give any error for local images...
Read more >
Requesting Multiple Images (Multi-URI) - Fresco
This option is supported only for local URIs, and only for images in the JPEG ... Only if none were found there either...
Read more >
Feature request: Update image URI even though current URI ...
Currently, if the Original URIs are valid, using the Search function to direct to a new folder will not change the Replacement URIs...
Read more >
Data Uris For Image Archives - Carl Boettiger
As I discussed above, I have recently experimented with hosting all images I generate on the local server, removing the dependency and archival ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found