Allow FlatShadowNode mouting to its own view

Summary: @public This diff adds a `FlatShadowNode.forceMountToView()` method that will render its contents in it own `View`.

Reviewed By: sriramramani

Differential Revision: D2564502
This commit is contained in:
Denis Koroskin
2015-12-13 15:54:52 -08:00
committed by Ahmed El-Helw
parent 7db444c9ae
commit 8de2acd3a9
12 changed files with 472 additions and 118 deletions

View File

@@ -23,12 +23,18 @@ import com.facebook.react.uimanager.ViewManagerRegistry;
* FlatNativeViewHierarchyManager is the only class that performs View manipulations. All of this
* class methods can only be called from UI thread by {@link FlatUIViewOperationQueue}.
*/
/* package */ final class FlatNativeViewHierarchyManager extends NativeViewHierarchyManager {
/* package */ final class FlatNativeViewHierarchyManager extends NativeViewHierarchyManager
implements ViewResolver {
/* package */ FlatNativeViewHierarchyManager(ViewManagerRegistry viewManagers) {
super(viewManagers);
}
@Override
public View getView(int reactTag) {
return super.resolveView(reactTag);
}
@Override
public void addRootView(
int tag,
@@ -60,6 +66,11 @@ import com.facebook.react.uimanager.ViewManagerRegistry;
}
}
/* package */ void updateViewGroup(int reactTag, int[] viewsToAdd, int[] viewsToDetach) {
FlatViewGroup view = (FlatViewGroup) resolveView(reactTag);
view.mountViews(this, viewsToAdd, viewsToDetach);
}
/**
* Updates View bounds, possibly re-measuring and re-layouting it if the size changed.
*
@@ -85,4 +96,11 @@ import com.facebook.react.uimanager.ViewManagerRegistry;
view.offsetTopAndBottom(top - view.getTop());
}
}
/* package */ void detachAllChildrenFromViews(int[] viewsToDetachAllChildrenFrom) {
for (int viewTag : viewsToDetachAllChildrenFrom) {
FlatViewGroup viewGroup = (FlatViewGroup) resolveView(viewTag);
viewGroup.detachAllViewsFromParent();
}
}
}