{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/10654","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/10654/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/10654/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/10654/events","html_url":"https://github.com/facebook/react-native/pull/10654","id":186284243,"number":10654,"title":"Add prop + event for blacklisting URL-schemes in WebView","user":{"login":"cbrevik","id":4932625,"avatar_url":"https://avatars.githubusercontent.com/u/4932625?v=3","gravatar_id":"","url":"https://api.github.com/users/cbrevik","html_url":"https://github.com/cbrevik","followers_url":"https://api.github.com/users/cbrevik/followers","following_url":"https://api.github.com/users/cbrevik/following{/other_user}","gists_url":"https://api.github.com/users/cbrevik/gists{/gist_id}","starred_url":"https://api.github.com/users/cbrevik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbrevik/subscriptions","organizations_url":"https://api.github.com/users/cbrevik/orgs","repos_url":"https://api.github.com/users/cbrevik/repos","events_url":"https://api.github.com/users/cbrevik/events{/privacy}","received_events_url":"https://api.github.com/users/cbrevik/received_events","type":"User","site_admin":false},"labels":[{"id":196858975,"url":"https://api.github.com/repos/facebook/react-native/labels/CLA%20Signed","name":"CLA Signed","color":"e7e7e7","default":false},{"id":172176599,"url":"https://api.github.com/repos/facebook/react-native/labels/GH%20Review:%20review-needed","name":"GH Review: review-needed","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-10-31T13:33:52Z","updated_at":"2016-11-11T19:43:07Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/10654","html_url":"https://github.com/facebook/react-native/pull/10654","diff_url":"https://github.com/facebook/react-native/pull/10654.diff","patch_url":"https://github.com/facebook/react-native/pull/10654.patch"},"body":"**Motivation**\r\nSee #10055. As the issue says, a non-handled custom URL-scheme will throw an error on Android.\r\nThe motivation behind this PR is to make blocking URL-schemes more customizable. \r\n\r\nIn my specific use-case I do not want the URL to load, but I still need to intercept it. I've added a  `rejectedUrlSchemes` array on `WebView`, which will let you set which schemes to block from loading, and a `onUrlSchemeRejected` event to notify you when an URL has been blocked.\r\n\r\nOn iOS you can normally handle it by implementing `onShouldStartLoadWithRequest`. But, what I've found is that `onShouldStartLoadWithRequest` can fail because it depends on an async callback from your JS code. If the code or device is a bit slow for whatever reason, it might not return true or false fast enough for `onShouldStartLoadWithRequest`. \r\n\r\nSo, this PR is an attempt to instead provide a synchronous alternative for blocking certain URL-schemes on both Android and iOS. \r\n\r\n**Test plan**\r\n\r\n```javascript\r\n<WebView\r\n  source={{ uri: \"customscheme://hello/2\" }}\r\n  onUrlSchemeRejected={(event) => console.log(event.nativeEvent)}\r\n  rejectedUrlSchemes={[\"customscheme\"]}\r\n  />\r\n```\r\n\r\nThe above should blacklist `customscheme` and block the above URL from loading. It should also log the given event which has an `url` and a `scheme` property."},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/260039140","html_url":"https://github.com/facebook/react-native/pull/10654#issuecomment-260039140","issue_url":"https://api.github.com/repos/facebook/react-native/issues/10654","id":260039140,"user":{"login":"hramos","id":165856,"avatar_url":"https://avatars.githubusercontent.com/u/165856?v=3","gravatar_id":"","url":"https://api.github.com/users/hramos","html_url":"https://github.com/hramos","followers_url":"https://api.github.com/users/hramos/followers","following_url":"https://api.github.com/users/hramos/following{/other_user}","gists_url":"https://api.github.com/users/hramos/gists{/gist_id}","starred_url":"https://api.github.com/users/hramos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hramos/subscriptions","organizations_url":"https://api.github.com/users/hramos/orgs","repos_url":"https://api.github.com/users/hramos/repos","events_url":"https://api.github.com/users/hramos/events{/privacy}","received_events_url":"https://api.github.com/users/hramos/received_events","type":"User","site_admin":false},"created_at":"2016-11-11T19:43:07Z","updated_at":"2016-11-11T19:43:07Z","body":"I'm going through open PRs to see what can be merged. Looks like @10772 is still open, so I'm going to leave this one open as well."}}
{"actor":{"display_login":"hramos"}}