-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Loading images fetched with RNFetchBlob from WebView #197
Comments
@plougsgaard , haven't tried this before, but I think add a file URI scheme |
@wkh237 I should have said so, but I've tried |
I'm not familiar with webview, could it because content-security-policy or CORS ? |
That's definitely a possibility (CSP) - I'll try getting a hold of an Android phone to test that (won't have the issue if that's what's wrong). |
Another alternative way is pass the file's BASE64 string via |
Heh, that'll be slow though (through the bridge). 😄 |
Figured it out finally! Some notes if anyone else should be in the same pickle later:
|
Oh my holy S%%T. @plougsgaard if I was in front of you, I would kiss you!. I've been stuck on this for 3 days and got really desperate with it. Your answer it's just marvelous.... it worked perfect thanks to that! |
@Ruffeng haha thanks a lot for the (too) kind words! 😄 |
@Ruffeng I felt totally same as you. It was a great help!!! @plougsgaard Thank you soooooooo much! My app shows video by WebView using html5 video tag both from http url and local files. It usually use Url but when after an user download a video, locally saved video file is used. What does baseUrl property acually do? |
Oh I found it works as well when I put any string in baseUrl property.. |
@plougsgaard You are a freaking legend ! How did you find that by yourself ? Finally I can manipulate my images in CSS rather than with gl-react |
My image is even not downloading.
But res show correct path:( |
I can not get this working on react-native 0.56.0 and 0.57.0 :/ |
Works for me when using react-native-webview and passing The related issue in react-native is: facebook/react-native#21104 |
Where did you save your html file? Is it in "DocumentDir" directory? |
@lourencogui I use |
I use RNFetchBlob to download and save images to the
RNFetchBlob.fs.dirs.DocumentDir
folder like so:I later wish to load these images from within a local webapp running in a WebView (just a simple HTML page with some
<img ../>
tags).The
WebView
gives me a404
but I'm not sure why. I usefinalFilename
assrc
.WebView
or something?I've asked a similar question (without the reference to this library) here, but I think it's more likely to have something to do with this library. For reference here's the other question.
http://stackoverflow.com/questions/40804298/load-local-image-file-from-within-webview
The text was updated successfully, but these errors were encountered: