React packager does not reload required HTML file for WebView
See original GitHub issueDescription
I have simple HTML file asset and are using WebView
to display it. Works fine for first time but when I reload simulator with cmd-r
the HTML file is not reloaded when I change it.
<WebView
style={{width: 300}}
source={require('./html/index.html')}
javaScriptEnabled={true}
/>
logs from packager:
[11/4/2016, 10:56:31 AM] <END> Initializing Packager (559ms)
[11/4/2016, 10:56:35 AM] <START> Requesting bundle: {"url":"/index.ios.bundle?platform=ios&dev=true&minify=false"}
[11/4/2016, 10:56:35 AM] <START> Transforming modules
transformed 644/644 (100%)
[11/4/2016, 10:56:35 AM] <END> Transforming modules (353ms)
[11/4/2016, 10:56:35 AM] <END> Requesting bundle: {"url":"/index.ios.bundle?platform=ios&dev=true&minify=false"} (466ms)
[11/4/2016, 10:56:36 AM] <START> Processing asset request: {"asset":"html/index.html"}
[11/4/2016, 10:56:36 AM] <END> Processing asset request: {"asset":"html/index.html"} (4ms)
[11/4/2016, 10:56:46 AM] <START> Requesting bundle: {"url":"/index.ios.bundle?platform=ios&dev=true&minify=false"}
[11/4/2016, 10:56:46 AM] <END> Requesting bundle: {"url":"/index.ios.bundle?platform=ios&dev=true&minify=false"} (28ms)
[11/4/2016, 10:57:09 AM] <START> Requesting bundle: {"url":"/index.ios.bundle?platform=ios&dev=true&minify=false"}
[11/4/2016, 10:57:09 AM] <START> Transforming modules
transformed 644/644 (100%)
[11/4/2016, 10:57:09 AM] <END> Transforming modules (366ms)
[11/4/2016, 10:57:10 AM] <END> Requesting bundle: {"url":"/index.ios.bundle?platform=ios&dev=true&minify=false"} (537ms)
as we can see html is served only once. HTML is reloaded (once) after manually restarting packager.
Additional Information
- React Native version: “react-native”: “0.36.1”
- Platform: iOS (android not tested)
- Operating System: MacOS
Issue Analytics
- State:
- Created 7 years ago
- Reactions:4
- Comments:13 (7 by maintainers)
Top Results From Across the Web
(React Native) Load local HTML file into WebView
6 Answers 6 · Add your .html file in your project. · Write such lines of code in the file where you want...
Read more >No way to load a local HTML file in the webview on Android
Bug description: I have a file with name index.html. I'm trying to load the file into the webview. However, there seems to be...
Read more >Load Local HTML File or URL in React Native using ...
How to open any URL, Local HTML File and or any HTML in Recat native App using WebView component provided by react-native-webview.
Read more >React Native: How to Load SPA or Static HTML Site inside ...
React Native WebView allows you to load a publicly accessible resource with the uri property. It works just as a usual website inside...
Read more >WebView
Loads static HTML or a URI (with optional headers) in the WebView. Note that static HTML will require setting originWhitelist to ["*"] ....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@@dannycochran I’ve trouble check the issue you have, and it is not strictly due to the same reason. You’re problem comes down
node_modules/react-native/packager/react-packager/src/Server/index.js
:You may fix it yourself doing:
I’m going to propose another PR on 0.37.x: https://github.com/facebook/react-native/pull/10919
Cheers, Alex
I reckon the issue might concern any assets as a matter of fact.
It seems to be due to the latest changes made on the AssetServer. It used to work before, and then I was using RN 0.34.0.
I’m currently working around the issue editing the file
node_modules/react-native/packager/react-packager/src/AssetServer/index.js
:Once I’ve pinpointed the solution, I’ll share it around, unless anyone comes first 😉.