void updateViewGroup(int reactTag, int[] viewsToAdd, int[] viewsToDetach) {
View view = resolveView(reactTag);
if (view instanceof FlatViewGroup) {
((FlatViewGroup) view).mountViews(this, viewsToAdd, viewsToDetach);
return;
}
ViewGroup viewGroup = (ViewGroup) view;
ViewGroupManager viewManager = (ViewGroupManager) resolveViewManager(reactTag);
List<View> listOfViews = new ArrayList<>(viewsToAdd.length);
// batch the set of additions - some view managers can take advantage of the batching to
// decrease operations, etc.
for (int viewIdToAdd : viewsToAdd) {
int tag = Math.abs(viewIdToAdd);
listOfViews.add(resolveView(tag));
}
viewManager.addViews(viewGroup, listOfViews);
}
java类com.facebook.react.uimanager.ViewGroupManager的实例源码
FlatNativeViewHierarchyManager.java 文件源码
项目:RNLearn_Project1
阅读 41
收藏 0
点赞 0
评论 0
NativeViewWrapper.java 文件源码
项目:RNLearn_Project1
阅读 27
收藏 0
点赞 0
评论 0
NativeViewWrapper(ViewManager viewManager) {
ReactShadowNode reactShadowNode = viewManager.createShadowNodeInstance();
if (reactShadowNode instanceof YogaMeasureFunction) {
mReactShadowNode = reactShadowNode;
setMeasureFunction((YogaMeasureFunction) reactShadowNode);
} else {
mReactShadowNode = null;
}
if (viewManager instanceof ViewGroupManager) {
ViewGroupManager viewGroupManager = (ViewGroupManager) viewManager;
mNeedsCustomLayoutForChildren = viewGroupManager.needsCustomLayoutForChildren();
mForceMountGrandChildrenToView = viewGroupManager.shouldPromoteGrandchildren();
} else {
mNeedsCustomLayoutForChildren = false;
}
forceMountToView();
forceMountChildrenToView();
}
FlatNativeViewHierarchyManager.java 文件源码
项目:RNLearn_Project1
阅读 28
收藏 0
点赞 0
评论 0
void updateViewGroup(int reactTag, int[] viewsToAdd, int[] viewsToDetach) {
View view = resolveView(reactTag);
if (view instanceof FlatViewGroup) {
((FlatViewGroup) view).mountViews(this, viewsToAdd, viewsToDetach);
return;
}
ViewGroup viewGroup = (ViewGroup) view;
ViewGroupManager viewManager = (ViewGroupManager) resolveViewManager(reactTag);
List<View> listOfViews = new ArrayList<>(viewsToAdd.length);
// batch the set of additions - some view managers can take advantage of the batching to
// decrease operations, etc.
for (int viewIdToAdd : viewsToAdd) {
int tag = Math.abs(viewIdToAdd);
listOfViews.add(resolveView(tag));
}
viewManager.addViews(viewGroup, listOfViews);
}
NativeViewWrapper.java 文件源码
项目:RNLearn_Project1
阅读 31
收藏 0
点赞 0
评论 0
NativeViewWrapper(ViewManager viewManager) {
ReactShadowNode reactShadowNode = viewManager.createShadowNodeInstance();
if (reactShadowNode instanceof YogaMeasureFunction) {
mReactShadowNode = reactShadowNode;
setMeasureFunction((YogaMeasureFunction) reactShadowNode);
} else {
mReactShadowNode = null;
}
if (viewManager instanceof ViewGroupManager) {
ViewGroupManager viewGroupManager = (ViewGroupManager) viewManager;
mNeedsCustomLayoutForChildren = viewGroupManager.needsCustomLayoutForChildren();
mForceMountGrandChildrenToView = viewGroupManager.shouldPromoteGrandchildren();
} else {
mNeedsCustomLayoutForChildren = false;
}
forceMountToView();
forceMountChildrenToView();
}
FlatNativeViewHierarchyManager.java 文件源码
项目:RNLearn_Project1
阅读 41
收藏 0
点赞 0
评论 0
void detachAllChildrenFromViews(int[] viewsToDetachAllChildrenFrom) {
for (int viewTag : viewsToDetachAllChildrenFrom) {
View view = resolveView(viewTag);
if (view instanceof FlatViewGroup) {
((FlatViewGroup) view).detachAllViewsFromParent();
continue;
}
ViewGroup viewGroup = (ViewGroup) view;
ViewGroupManager viewManager = (ViewGroupManager) resolveViewManager(viewTag);
viewManager.removeAllViews(viewGroup);
}
}
FlatNativeViewHierarchyManager.java 文件源码
项目:RNLearn_Project1
阅读 33
收藏 0
点赞 0
评论 0
void detachAllChildrenFromViews(int[] viewsToDetachAllChildrenFrom) {
for (int viewTag : viewsToDetachAllChildrenFrom) {
View view = resolveView(viewTag);
if (view instanceof FlatViewGroup) {
((FlatViewGroup) view).detachAllViewsFromParent();
continue;
}
ViewGroup viewGroup = (ViewGroup) view;
ViewGroupManager viewManager = (ViewGroupManager) resolveViewManager(viewTag);
viewManager.removeAllViews(viewGroup);
}
}