{"action":"opened","number":10844,"pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/10844","id":93087581,"html_url":"https://github.com/facebook/react-native/pull/10844","diff_url":"https://github.com/facebook/react-native/pull/10844.diff","patch_url":"https://github.com/facebook/react-native/pull/10844.patch","issue_url":"https://api.github.com/repos/facebook/react-native/issues/10844","number":10844,"state":"open","locked":false,"title":"Cache Policy control for Image source","user":{"login":"salanki","id":192223,"avatar_url":"https://avatars.githubusercontent.com/u/192223?v=3","gravatar_id":"","url":"https://api.github.com/users/salanki","html_url":"https://github.com/salanki","followers_url":"https://api.github.com/users/salanki/followers","following_url":"https://api.github.com/users/salanki/following{/other_user}","gists_url":"https://api.github.com/users/salanki/gists{/gist_id}","starred_url":"https://api.github.com/users/salanki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salanki/subscriptions","organizations_url":"https://api.github.com/users/salanki/orgs","repos_url":"https://api.github.com/users/salanki/repos","events_url":"https://api.github.com/users/salanki/events{/privacy}","received_events_url":"https://api.github.com/users/salanki/received_events","type":"User","site_admin":false},"body":"## Motivation\r\nIn the context of an app an image exists in three resolutions on the server: `thumb` (30px) `feed` (300px) `full` (900px). When looking at an individual item a user can come either from the feed, via a permalink or from other parts of the app. This allows a situation where the `feed` image might or might not already be loaded somewhere in the app. In the detail view I want to render `thumb` with a blur (to quickly display something), then the `feed` image if it exists to have something decent to display until `full` loads. However it is quite a waste to load the `feed` image if it isn't already in cache, and will slow down the time until `full` is loaded. It is possible to track the navigation from feed->detail and that the `feed` image has actually completed loading by the feed component however as component hierarchies grow this turns into quite a lot of prop passing and bad separation of concerns.\r\n\r\n## Solution\r\nNSURLRequests accepts a [Cache Policy](https://developer.apple.com/reference/foundation/nsurlrequest.cachepolicy) that can be used to control a requests interaction with the cache. For the use case in motivation a cache policy of `returnCacheDataDontLoad` fulfills the requirement.\r\n\r\nThis PR exposes the `cachePolicy` property to the Image Source, using the same naming as the iOS constants.\r\n\r\n## Notes\r\n\r\n* An example is added to UIExplorer for both demonstration and testing purposes, however this can be removed if deemed redundant.\r\n* Documentation of the different cache options is currently not provided but only a reference to the underlying iOS API. Description of the options can be included in the RN documentation as well  if desired.","created_at":"2016-11-10T05:01:59Z","updated_at":"2016-11-10T05:01:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/facebook/react-native/pulls/10844/commits","review_comments_url":"https://api.github.com/repos/facebook/react-native/pulls/10844/comments","review_comment_url":"https://api.github.com/repos/facebook/react-native/pulls/comments{/number}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/10844/comments","statuses_url":"https://api.github.com/repos/facebook/react-native/statuses/01de8d20b319024dbe95600aee89eccc2d61f6fd","head":{"label":"salanki:master","ref":"master","sha":"01de8d20b319024dbe95600aee89eccc2d61f6fd","user":{"login":"salanki","id":192223,"avatar_url":"https://avatars.githubusercontent.com/u/192223?v=3","gravatar_id":"","url":"https://api.github.com/users/salanki","html_url":"https://github.com/salanki","followers_url":"https://api.github.com/users/salanki/followers","following_url":"https://api.github.com/users/salanki/following{/other_user}","gists_url":"https://api.github.com/users/salanki/gists{/gist_id}","starred_url":"https://api.github.com/users/salanki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salanki/subscriptions","organizations_url":"https://api.github.com/users/salanki/orgs","repos_url":"https://api.github.com/users/salanki/repos","events_url":"https://api.github.com/users/salanki/events{/privacy}","received_events_url":"https://api.github.com/users/salanki/received_events","type":"User","site_admin":false},"repo":{"id":73347638,"name":"react-native","full_name":"salanki/react-native","owner":{"login":"salanki","id":192223,"avatar_url":"https://avatars.githubusercontent.com/u/192223?v=3","gravatar_id":"","url":"https://api.github.com/users/salanki","html_url":"https://github.com/salanki","followers_url":"https://api.github.com/users/salanki/followers","following_url":"https://api.github.com/users/salanki/following{/other_user}","gists_url":"https://api.github.com/users/salanki/gists{/gist_id}","starred_url":"https://api.github.com/users/salanki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/salanki/subscriptions","organizations_url":"https://api.github.com/users/salanki/orgs","repos_url":"https://api.github.com/users/salanki/repos","events_url":"https://api.github.com/users/salanki/events{/privacy}","received_events_url":"https://api.github.com/users/salanki/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/salanki/react-native","description":"A framework for building native apps with React.","fork":true,"url":"https://api.github.com/repos/salanki/react-native","forks_url":"https://api.github.com/repos/salanki/react-native/forks","keys_url":"https://api.github.com/repos/salanki/react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/salanki/react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/salanki/react-native/teams","hooks_url":"https://api.github.com/repos/salanki/react-native/hooks","issue_events_url":"https://api.github.com/repos/salanki/react-native/issues/events{/number}","events_url":"https://api.github.com/repos/salanki/react-native/events","assignees_url":"https://api.github.com/repos/salanki/react-native/assignees{/user}","branches_url":"https://api.github.com/repos/salanki/react-native/branches{/branch}","tags_url":"https://api.github.com/repos/salanki/react-native/tags","blobs_url":"https://api.github.com/repos/salanki/react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/salanki/react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/salanki/react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/salanki/react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/salanki/react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/salanki/react-native/languages","stargazers_url":"https://api.github.com/repos/salanki/react-native/stargazers","contributors_url":"https://api.github.com/repos/salanki/react-native/contributors","subscribers_url":"https://api.github.com/repos/salanki/react-native/subscribers","subscription_url":"https://api.github.com/repos/salanki/react-native/subscription","commits_url":"https://api.github.com/repos/salanki/react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/salanki/react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/salanki/react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/salanki/react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/salanki/react-native/contents/{+path}","compare_url":"https://api.github.com/repos/salanki/react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/salanki/react-native/merges","archive_url":"https://api.github.com/repos/salanki/react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/salanki/react-native/downloads","issues_url":"https://api.github.com/repos/salanki/react-native/issues{/number}","pulls_url":"https://api.github.com/repos/salanki/react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/salanki/react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/salanki/react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/salanki/react-native/labels{/name}","releases_url":"https://api.github.com/repos/salanki/react-native/releases{/id}","deployments_url":"https://api.github.com/repos/salanki/react-native/deployments","created_at":"2016-11-10T04:39:15Z","updated_at":"2016-11-10T04:39:25Z","pushed_at":"2016-11-10T04:57:28Z","git_url":"git://github.com/salanki/react-native.git","ssh_url":"git@github.com:salanki/react-native.git","clone_url":"https://github.com/salanki/react-native.git","svn_url":"https://github.com/salanki/react-native","homepage":"http://facebook.github.io/react-native/","size":153849,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"facebook:master","ref":"master","sha":"7596e1aaec2663cfb8877dd1c8d0b9fd6ff2ed03","user":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"repo":{"id":29028775,"name":"react-native","full_name":"facebook/react-native","owner":{"login":"facebook","id":69631,"avatar_url":"https://avatars.githubusercontent.com/u/69631?v=3","gravatar_id":"","url":"https://api.github.com/users/facebook","html_url":"https://github.com/facebook","followers_url":"https://api.github.com/users/facebook/followers","following_url":"https://api.github.com/users/facebook/following{/other_user}","gists_url":"https://api.github.com/users/facebook/gists{/gist_id}","starred_url":"https://api.github.com/users/facebook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/facebook/subscriptions","organizations_url":"https://api.github.com/users/facebook/orgs","repos_url":"https://api.github.com/users/facebook/repos","events_url":"https://api.github.com/users/facebook/events{/privacy}","received_events_url":"https://api.github.com/users/facebook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/facebook/react-native","description":"A framework for building native apps with React.","fork":false,"url":"https://api.github.com/repos/facebook/react-native","forks_url":"https://api.github.com/repos/facebook/react-native/forks","keys_url":"https://api.github.com/repos/facebook/react-native/keys{/key_id}","collaborators_url":"https://api.github.com/repos/facebook/react-native/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/facebook/react-native/teams","hooks_url":"https://api.github.com/repos/facebook/react-native/hooks","issue_events_url":"https://api.github.com/repos/facebook/react-native/issues/events{/number}","events_url":"https://api.github.com/repos/facebook/react-native/events","assignees_url":"https://api.github.com/repos/facebook/react-native/assignees{/user}","branches_url":"https://api.github.com/repos/facebook/react-native/branches{/branch}","tags_url":"https://api.github.com/repos/facebook/react-native/tags","blobs_url":"https://api.github.com/repos/facebook/react-native/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/facebook/react-native/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/facebook/react-native/git/refs{/sha}","trees_url":"https://api.github.com/repos/facebook/react-native/git/trees{/sha}","statuses_url":"https://api.github.com/repos/facebook/react-native/statuses/{sha}","languages_url":"https://api.github.com/repos/facebook/react-native/languages","stargazers_url":"https://api.github.com/repos/facebook/react-native/stargazers","contributors_url":"https://api.github.com/repos/facebook/react-native/contributors","subscribers_url":"https://api.github.com/repos/facebook/react-native/subscribers","subscription_url":"https://api.github.com/repos/facebook/react-native/subscription","commits_url":"https://api.github.com/repos/facebook/react-native/commits{/sha}","git_commits_url":"https://api.github.com/repos/facebook/react-native/git/commits{/sha}","comments_url":"https://api.github.com/repos/facebook/react-native/comments{/number}","issue_comment_url":"https://api.github.com/repos/facebook/react-native/issues/comments{/number}","contents_url":"https://api.github.com/repos/facebook/react-native/contents/{+path}","compare_url":"https://api.github.com/repos/facebook/react-native/compare/{base}...{head}","merges_url":"https://api.github.com/repos/facebook/react-native/merges","archive_url":"https://api.github.com/repos/facebook/react-native/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/facebook/react-native/downloads","issues_url":"https://api.github.com/repos/facebook/react-native/issues{/number}","pulls_url":"https://api.github.com/repos/facebook/react-native/pulls{/number}","milestones_url":"https://api.github.com/repos/facebook/react-native/milestones{/number}","notifications_url":"https://api.github.com/repos/facebook/react-native/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/facebook/react-native/labels{/name}","releases_url":"https://api.github.com/repos/facebook/react-native/releases{/id}","deployments_url":"https://api.github.com/repos/facebook/react-native/deployments","created_at":"2015-01-09T18:10:16Z","updated_at":"2016-11-10T04:46:33Z","pushed_at":"2016-11-10T03:58:40Z","git_url":"git://github.com/facebook/react-native.git","ssh_url":"git@github.com:facebook/react-native.git","clone_url":"https://github.com/facebook/react-native.git","svn_url":"https://github.com/facebook/react-native","homepage":"http://facebook.github.io/react-native/","size":153892,"stargazers_count":40168,"watchers_count":40168,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":9045,"mirror_url":null,"open_issues_count":982,"forks":9045,"open_issues":982,"watchers":40168,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/facebook/react-native/pulls/10844"},"html":{"href":"https://github.com/facebook/react-native/pull/10844"},"issue":{"href":"https://api.github.com/repos/facebook/react-native/issues/10844"},"comments":{"href":"https://api.github.com/repos/facebook/react-native/issues/10844/comments"},"review_comments":{"href":"https://api.github.com/repos/facebook/react-native/pulls/10844/comments"},"review_comment":{"href":"https://api.github.com/repos/facebook/react-native/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/facebook/react-native/pulls/10844/commits"},"statuses":{"href":"https://api.github.com/repos/facebook/react-native/statuses/01de8d20b319024dbe95600aee89eccc2d61f6fd"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":1,"additions":57,"deletions":1,"changed_files":4}}
{"actor":{"display_login":"salanki"}}