{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/8089","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/8089/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/8089/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/8089/events","html_url":"https://github.com/facebook/react-native/issues/8089","id":159933881,"number":8089,"title":"Bug: WebView won't load javascript locally.","user":{"login":"cablegunmaster","id":8159246,"avatar_url":"https://avatars3.githubusercontent.com/u/8159246?v=4","gravatar_id":"","url":"https://api.github.com/users/cablegunmaster","html_url":"https://github.com/cablegunmaster","followers_url":"https://api.github.com/users/cablegunmaster/followers","following_url":"https://api.github.com/users/cablegunmaster/following{/other_user}","gists_url":"https://api.github.com/users/cablegunmaster/gists{/gist_id}","starred_url":"https://api.github.com/users/cablegunmaster/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cablegunmaster/subscriptions","organizations_url":"https://api.github.com/users/cablegunmaster/orgs","repos_url":"https://api.github.com/users/cablegunmaster/repos","events_url":"https://api.github.com/users/cablegunmaster/events{/privacy}","received_events_url":"https://api.github.com/users/cablegunmaster/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2016-06-13T12:00:31Z","updated_at":"2018-04-24T16:58:06Z","closed_at":"2016-10-27T21:49:23Z","author_association":"NONE","body":"Question and bug report at the same time, there is a difference in including HTML from the source prop and getting it from a external source. (webpage)\n\nSituation A: If I include JS from a Html page on a different source its running fine. like trying to include a Webpage.\n\nSituation B: If I run the JS Inline on the webpage it won't run the javascript or just be ignored eventhough  javaScriptEnabled={true}  I made a var with all the  HTML\n\n```\nvar html = <html>\n<head>\n   <script type=\"text/javascript\">\n        //big blob of javascript library. which works online and offline in the browser but not on the webview     internally, but if loaded externally it does. kinda want to know how to debug.\n   </script>\n</head>\n<body>\nWe are here! some text to test if its visible or not. Works though.\n</body>\n</html>\n`\n\n\nrender() {\n            <WebView\n                style={{ height: 200, width: 200}}\n                source={{html: HTML}}\n                scalesPageToFit={true}\n                javaScriptEnabled={true}\n            />\n```\n\n}\n`\nOutput: \nWe are here! some text to test if its visible or not. Works though.  , (but no JS mutation etc).\n\n_How did I find this out?_\nI tried running console.log(HTML); and used Diff checker (online checking source) both sources seemed to run the same code. and the graph i'm trying to show does not display on only one of them. It does display on the FF or chrome Webbrowser , and if I include it as a external webpage. But not if asked to run as a source immedialy on the WebView.\n\nJust wondering what I can do to make a JS library work offline.\nProbably I'm not understanding how to use WebView Locally with a JS library.  but I can't find anyone who knows more about this.\n\nOS: Android.\nReact-native 0.27.2\n\nAddendum:\n- JavascriptInjected used and simple things like alert('hello world') works but there is information lacking about when to use javascriptInjected, how to use it. and what I can input it and can't.\n  Because I have no idea in which lifecycle the Webview Works I can't be able to work with it, can this be clearified? I am trying to make a graph. but it ain't loading.\n\nStep 1 Load JS script.\nStep 2 find a Canvas ID from webview's HTML.\nStep 3 display graph on that Canvas ID using javascript.\n"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/384005363","html_url":"https://github.com/facebook/react-native/issues/8089#issuecomment-384005363","issue_url":"https://api.github.com/repos/facebook/react-native/issues/8089","id":384005363,"user":{"login":"Arshiamidos","id":6451804,"avatar_url":"https://avatars0.githubusercontent.com/u/6451804?v=4","gravatar_id":"","url":"https://api.github.com/users/Arshiamidos","html_url":"https://github.com/Arshiamidos","followers_url":"https://api.github.com/users/Arshiamidos/followers","following_url":"https://api.github.com/users/Arshiamidos/following{/other_user}","gists_url":"https://api.github.com/users/Arshiamidos/gists{/gist_id}","starred_url":"https://api.github.com/users/Arshiamidos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Arshiamidos/subscriptions","organizations_url":"https://api.github.com/users/Arshiamidos/orgs","repos_url":"https://api.github.com/users/Arshiamidos/repos","events_url":"https://api.github.com/users/Arshiamidos/events{/privacy}","received_events_url":"https://api.github.com/users/Arshiamidos/received_events","type":"User","site_admin":false},"created_at":"2018-04-24T16:58:06Z","updated_at":"2018-04-24T16:58:06Z","author_association":"NONE","body":"hey guys  \r\nfound the trick base on [Image doesn't show after bundling into the apk](https://github.com/facebook/react-native/issues/4084).   \r\nas you know **require('index.html')** work on _simulator_ and _emulator_ for both &driod and IOS  \r\nbut problem will faced when you bundle and you want release your app   \r\nfor android just follow this  **enablejavascript**  and copy you files in **assets** folder in `YOUR_APP/app/src/main/assets` and use just picture below.  \r\n\r\nand for ios just bundle package with \r\n`react-native bundle --entry-file index.ios.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios`\r\nwhen bundle created you have **main.bundle.js** and **asset** folder   \r\njust copy you files in  **.xcworkspace** like this image  \r\n![ios](https://user-images.githubusercontent.com/6451804/39201543-963c2e00-4804-11e8-9031-fb87a9f2c46e.jpg)\r\nand set free all **refrence** in will be and unchanged just like mine. \r\n![screen shot - - at](https://user-images.githubusercontent.com/6451804/39201713-1260aeac-4805-11e8-92dd-efd9209cb44f.png)\r\ni hope this tutorial help you from confusing release app in RN "}}
{"actor":{"display_login":"Arshiamidos"}}