Implement addUIBlock to allow third party to resolve a view

Summary:
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.

The 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.

This is already possible in iOS API. a third party can use the `addUIBlock` too.
I 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).

 ---

With this PR a third party lib can now do...

```java
UIManagerModule uiManager = reactContext.getNativeModule(UIManagerModule.class);
uiManager.addUIBlock(new UIBlock() {
  public void execute (NativeViewHierarchyManager nvhm) {
    View view = nvhm.resolveView(tag);
    ...do something with view... like... screenshot t
Closes https://github.com/facebook/react-native/pull/8217

Differential Revision: D3469311

Pulled By: astreet

fbshipit-source-id: bb56ecc7e8936299337af47ca8114875ee1fd2b0
This commit is contained in:
Gaëtan Renaudeau
2016-06-22 06:18:51 -07:00
committed by Facebook Github Bot 2
parent 4c83237511
commit af28de5300
5 changed files with 52 additions and 2 deletions

View File

@@ -774,4 +774,8 @@ public class UIImplementation {
}
cssNode.markUpdateSeen();
}
public void addUIBlock(UIBlock block) {
mOperationsQueue.enqueueUIBlock(block);
}
}