react-native icon indicating copy to clipboard operation
react-native copied to clipboard

[WebViewExample] Bundled HTML does not work

Open lu-ko opened this issue 10 years ago • 18 comments

I cannot render bundled HTML file in WebView. I suppose it is a bug in React Native because it does not work also in your WebViewExample and UIExplorer.

Error in Android emulator:

  • E/ReactNativeJS: Requiring unknown module "./helloworld.html". If you are sure the module is there, try restarting the packager.
  • Restart of packager did not help.
  • React Native version: 0.19

Error in your online UIExplorer:

  • Error loading page. Domain: NSURLErrorDomain. Error Code: -1100. Description: The requested URL was not found on this server.
  • See screenshot.

uiexplorer-webview-bundledhtml-error

lu-ko avatar Feb 18 '16 09:02 lu-ko

It's fixed in React Native v.0.20, but there is still the same error in UIExplorer. Maybe it was not upgraded to latest version yet. Thank you guys!

lu-ko avatar Feb 25 '16 17:02 lu-ko

+1 have encountered the same issues

letsila avatar Mar 18 '16 14:03 letsila

I have the same error and behavior , can't present local html in webView in both ios and Android. here's a sample RN app to demonstrate the behavior.

sample app

any idea? I'm on 0.23.1 and now testing on 0.24 and it also don't wokr.

slootzky avatar Apr 21 '16 11:04 slootzky

+1 It doesn't work on the latest 0.25.1

comiclee avatar May 11 '16 10:05 comiclee

@comiclee one solution is to load the html with require , I still haven't upgraded to 0.25 but it works for 0.23

slootzky avatar May 11 '16 12:05 slootzky

@rotemsloo, require html files can work in develope mode, but fails in release apk file

comiclee avatar May 12 '16 03:05 comiclee

+1. I'm seeing this on latest version. Debug build is fine, but release shows blank page.

ramilushev avatar May 17 '16 14:05 ramilushev

cc: @dmmiller

nicklockwood avatar May 17 '16 14:05 nicklockwood

Looking at release build now. Thanks for the heads up.

dmmiller avatar May 17 '16 16:05 dmmiller

As far as I can tell this got fixed. I'm going to close this issue but if people see it recur with recent builds of React Native please feel free to open a new issue.

lacker avatar Oct 26 '16 04:10 lacker

Its still not working, I mean its not fixed.

RN 0.36 on Android. Assets need to be manually placed as suggested above.

saumya avatar Nov 08 '16 14:11 saumya

Not working on RN 0.37 as well.

eggli avatar Nov 10 '16 09:11 eggli

Not working on RN 0.39.2 as well.

xsstomy avatar Jan 05 '17 03:01 xsstomy

Not working on RN 0.40 as well.

Lxxyx avatar Jan 24 '17 15:01 Lxxyx

Not working on RN 0.41 as well.

raymall avatar Feb 09 '17 01:02 raymall

on RN 0.40, require('./file.html') is failing for me in Build release variant. as others have mentioned above. As workaround, I was able to put the file in android assets dir, and { uri: file:///android_asset/file.html } it in from there. Unfortunately for my situation, the html file loads remote third-party libs which internally reference protocol-agnostic resources: e.g., //domain.com/file.json. So those all got turned into file://domain.com/file.json links and of course failed. I monkey patched XMLHttpRequest to change //... to https://... which solved that problem, but none of the images those libs attempt to load, will load. all broken. And I've been unable to find a way to determine what the requests look like for those images, to see why they break/fail-to-load.

wkw avatar Mar 06 '17 14:03 wkw

As @lacker was saying we should open a new issue, has anyone opened a new issue for this? Or should we continue in this thread? For me, it seems we should continue here only and re-open this one.

saumya avatar Mar 31 '17 08:03 saumya

It looks like this is being tracked in this issue now: https://github.com/facebook/react-native/issues/7924

FuadBalashov avatar May 02 '17 18:05 FuadBalashov