{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/8217","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/8217/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/8217/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/8217/events","html_url":"https://github.com/facebook/react-native/pull/8217","id":161034472,"number":8217,"title":"[Android] Implement addUIBlock to allow third party to resolve a view","user":{"login":"gre","id":211411,"avatar_url":"https://avatars.githubusercontent.com/u/211411?v=3","gravatar_id":"","url":"https://api.github.com/users/gre","html_url":"https://github.com/gre","followers_url":"https://api.github.com/users/gre/followers","following_url":"https://api.github.com/users/gre/following{/other_user}","gists_url":"https://api.github.com/users/gre/gists{/gist_id}","starred_url":"https://api.github.com/users/gre/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gre/subscriptions","organizations_url":"https://api.github.com/users/gre/orgs","repos_url":"https://api.github.com/users/gre/repos","events_url":"https://api.github.com/users/gre/events{/privacy}","received_events_url":"https://api.github.com/users/gre/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/react-native/labels/CLA%20Signed","name":"CLA Signed","color":"e7e7e7"},{"url":"https://api.github.com/repos/facebook/react-native/labels/GH%20Review:%20review-needed","name":"GH Review: review-needed","color":"fbca04"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-06-18T17:20:40Z","updated_at":"2016-06-19T05:54:43Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/facebook/react-native/pulls/8217","html_url":"https://github.com/facebook/react-native/pull/8217","diff_url":"https://github.com/facebook/react-native/pull/8217.diff","patch_url":"https://github.com/facebook/react-native/pull/8217.patch"},"body":"This PR follows the work started in #6431 but instead of implementing the snapshot for Android, will just allow that feature to be implemented by a third party library.\r\n\r\nThe missing feature is the ability to resolve a View for a given tag integer. which is now possible with a `addUIBlock` on the `UIManagerModule` method where you give a `UIBlock` instance (a new class) that implements a `execute(NativeViewHierarchyManager)` function.\r\n\r\nThis is already possible in iOS API. a third party can use the `addUIBlock` too.\r\nI have kept the name `addUIBlock` so it's the same as in the [iOS' API](https://github.com/facebook/react-native/search?q=addUIBlock&type=Code&utf8=%E2%9C%93).\r\n\r\n---\r\n\r\nWith this PR a third party lib can now do...\r\n\r\n```java\r\nUIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);\r\nuiManager.addUIBlock(new UIBlock() {\r\n  public void execute (NativeViewHierarchyManager nvhm) {\r\n    View view = nvhm.resolveView(tag);\r\n    ...do something with view... like... screenshot the view!\r\n  }\r\n});\r\n```\r\n\r\n...and we can finally implement that generic view screenshot in a third party library... [**-> this is a gist implementing it! <-**](https://gist.github.com/gre/c466944b8ee7c1b1f17ba79f145d0664)\r\n\r\n> NB: this gist will turn into a PR for @jsierles' [react-native-view-snapshot](https://github.com/jsierles/react-native-view-snapshot) library, when this gets into React Native."},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/226981082","html_url":"https://github.com/facebook/react-native/pull/8217#issuecomment-226981082","issue_url":"https://api.github.com/repos/facebook/react-native/issues/8217","id":226981082,"user":{"login":"christopherdro","id":3741055,"avatar_url":"https://avatars.githubusercontent.com/u/3741055?v=3","gravatar_id":"","url":"https://api.github.com/users/christopherdro","html_url":"https://github.com/christopherdro","followers_url":"https://api.github.com/users/christopherdro/followers","following_url":"https://api.github.com/users/christopherdro/following{/other_user}","gists_url":"https://api.github.com/users/christopherdro/gists{/gist_id}","starred_url":"https://api.github.com/users/christopherdro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christopherdro/subscriptions","organizations_url":"https://api.github.com/users/christopherdro/orgs","repos_url":"https://api.github.com/users/christopherdro/repos","events_url":"https://api.github.com/users/christopherdro/events{/privacy}","received_events_url":"https://api.github.com/users/christopherdro/received_events","type":"User","site_admin":false},"created_at":"2016-06-19T05:54:43Z","updated_at":"2016-06-19T05:54:43Z","body":"👍 I still vote to make the view snapshot part of core since the API for iOS has already been added."}}
{"actor":{"display_login":"christopherdro"}}