{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/505","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/505/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/505/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/505/events","html_url":"https://github.com/facebook/react-native/issues/505","id":65270306,"number":505,"title":"WebView: Add an option to load local resource from the app bundle","user":{"login":"pilwon","id":61540,"avatar_url":"https://avatars.githubusercontent.com/u/61540?v=3","gravatar_id":"","url":"https://api.github.com/users/pilwon","html_url":"https://github.com/pilwon","followers_url":"https://api.github.com/users/pilwon/followers","following_url":"https://api.github.com/users/pilwon/following{/other_user}","gists_url":"https://api.github.com/users/pilwon/gists{/gist_id}","starred_url":"https://api.github.com/users/pilwon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pilwon/subscriptions","organizations_url":"https://api.github.com/users/pilwon/orgs","repos_url":"https://api.github.com/users/pilwon/repos","events_url":"https://api.github.com/users/pilwon/events{/privacy}","received_events_url":"https://api.github.com/users/pilwon/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":40,"created_at":"2015-03-30T18:17:59Z","updated_at":"2016-10-03T00:52:18Z","closed_at":"2015-04-27T22:27:42Z","body":"`<WebView/>` currently only supports `url` prop to control what content to load in the web view.\r\n\r\nWe need an option to load local resource (mainly `html` but could be others too) from the application bundle.\r\n\r\nWe could either introduce a new prop for that or reuse `url` and do some magic conversion. For example, `local://<path>.<ext>` can be automatically converted to `file:///<converted-url>`.\r\n\r\n```obj-c\r\nNSURL *convertedURL = [[NSBundle mainBundle] URLForResource:@\"<path>\" withExtension:@\"<ext>\"];\r\n```\r\n\r\n(Use case: #497)\r\n\r\n---\r\n\r\n**[UPDATE]**\r\n\r\nAs @nicklockwood mentioned in his comment https://github.com/facebook/react-native/issues/505#issuecomment-96850121, this works out of box by simply setting a relative file path to `url` prop. (ex: `index.html`)"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/251008023","html_url":"https://github.com/facebook/react-native/issues/505#issuecomment-251008023","issue_url":"https://api.github.com/repos/facebook/react-native/issues/505","id":251008023,"user":{"login":"lorrainefox","id":1163489,"avatar_url":"https://avatars.githubusercontent.com/u/1163489?v=3","gravatar_id":"","url":"https://api.github.com/users/lorrainefox","html_url":"https://github.com/lorrainefox","followers_url":"https://api.github.com/users/lorrainefox/followers","following_url":"https://api.github.com/users/lorrainefox/following{/other_user}","gists_url":"https://api.github.com/users/lorrainefox/gists{/gist_id}","starred_url":"https://api.github.com/users/lorrainefox/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lorrainefox/subscriptions","organizations_url":"https://api.github.com/users/lorrainefox/orgs","repos_url":"https://api.github.com/users/lorrainefox/repos","events_url":"https://api.github.com/users/lorrainefox/events{/privacy}","received_events_url":"https://api.github.com/users/lorrainefox/received_events","type":"User","site_admin":false},"created_at":"2016-10-03T00:52:18Z","updated_at":"2016-10-03T00:52:18Z","body":"I'm working on a project using ReactNative for the front end and Android studio.   I cannot get the html to show when I create a signed apk.  The html displays when I run in debug mode running reactnative server.  Below is the code snippet in reactnative component, following the gradle build that copies the assets to res:\r\n\r\n<View accessibilityLabel={'statementBox'} style={styles.webviewContainer}>\r\n        <WebView\r\n          style={styles.webview}\r\n          source={require('./assets/ElectronicDelivery.html')}\r\n        />\r\n      </View>\r\n\r\n\"-c\", \"PATH=\\\"~/bin:\\$PATH\\\";\r\n[ -s \\\"\\$NVM_DIR/nvm.sh\\\" ] && . \\\"\\$NVM_DIR/nvm.sh\\\";\r\nsource ~/.nvm/nvm.sh; cd ${rootDir}/../../app-reactnative;\r\nreact-native bundle --platform android --dev false --entry-file index.android.js\r\n--bundle-output ../android/app-android/app/src/main/assets/index.android.bundle\r\n--assets-dest ../android/alpp-android/app/src/main/res/; exit 0\""}}
{"actor":{"display_login":"lorrainefox"}}