Java 类com.facebook.react.uimanager.ViewGroupManager 实例源码

项目:RNLearn_Project1    文件:FlatNativeViewHierarchyManager.java   
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);
}
项目:RNLearn_Project1    文件:NativeViewWrapper.java   
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();
}
项目:RNLearn_Project1    文件:FlatNativeViewHierarchyManager.java   
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);
}
项目:RNLearn_Project1    文件:NativeViewWrapper.java   
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();
}
项目:RNLearn_Project1    文件:FlatNativeViewHierarchyManager.java   
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);
  }
}
项目:RNLearn_Project1    文件:FlatNativeViewHierarchyManager.java   
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);
  }
}