Java 类com.facebook.yoga.YogaMeasureFunction 实例源码

项目: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    文件: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    文件:ReactShadowNode.java   
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
  if ((measureFunction == null ^ mYogaNode.isMeasureDefined()) &&
      getChildCount() != 0) {
    throw new RuntimeException(
      "Since a node with a measure function does not add any native yoga children, it's " +
        "not safe to transition to/from having a measure function unless a node has no children");
  }
  mYogaNode.setMeasureFunction(measureFunction);
}
项目:RNLearn_Project1    文件:ReactShadowNode.java   
public void setMeasureFunction(YogaMeasureFunction measureFunction) {
  if ((measureFunction == null ^ mYogaNode.isMeasureDefined()) &&
      getChildCount() != 0) {
    throw new RuntimeException(
      "Since a node with a measure function does not add any native yoga children, it's " +
        "not safe to transition to/from having a measure function unless a node has no children");
  }
  mYogaNode.setMeasureFunction(measureFunction);
}