类com.facebook.react.uimanager.ReactShadowNode源码实例Demo

下面列出了怎么用com.facebook.react.uimanager.ReactShadowNode的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: react-native-GPay   文件: FabricReconciler.java
private void enqueueUpdateProperties(ReactShadowNode newNode, ReactShadowNode prevNode) {
  int reactTag = newNode.getReactTag();
  if (DEBUG) {
    FLog.d(
      TAG,
      "manageChildren.enqueueUpdateProperties " +
        "\n\ttag: " + reactTag +
        "\n\tviewClass: " + newNode.getViewClass() +
        "\n\tinstanceHandle: " + newNode.getInstanceHandle() +
        "\n\tnewProps: " + newNode.getNewProps());
  }

  if (prevNode != null) {
    newNode.updateScreenLayout(prevNode);
  }

  if (newNode.getNewProps() != null) {
    uiViewOperationQueue.enqueueUpdateProperties(
      reactTag, newNode.getViewClass(), newNode.getNewProps());
  }

  uiViewOperationQueue.enqueueUpdateInstanceHandle(
    reactTag, newNode.getInstanceHandle());
}
 
源代码2 项目: react-native-GPay   文件: FabricUIManager.java
/**
 * @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
 *     ReactShadowNode will contain a copy of all the internal data of the original node,
 *     including its children set (note that the children nodes will not be cloned).
 */
@Nullable
@DoNotStrip
public ReactShadowNode cloneNode(ReactShadowNode node) {
  if (DEBUG) {
    FLog.d(TAG, "cloneNode \n\tnode: " + node);
  }
  SystraceMessage.beginSection(
    Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
    "FabricUIManager.cloneNode")
    .flush();
  try {
    ReactShadowNode clone = node.mutableCopy(node.getInstanceHandle());
    assertReactShadowNodeCopy(node, clone);
    return clone;
  } catch (Throwable t) {
    handleException(node, t);
    return null;
  } finally{
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
源代码3 项目: react-native-GPay   文件: FabricUIManager.java
/**
 * @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
 *     ReactShadowNode will contain a copy of all the internal data of the original node, but its
 *     children set will be empty.
 */
@Nullable
@DoNotStrip
public ReactShadowNode cloneNodeWithNewChildren(ReactShadowNode node) {
  if (DEBUG) {
    FLog.d(TAG, "cloneNodeWithNewChildren \n\tnode: " + node);
  }
  SystraceMessage.beginSection(
    Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
    "FabricUIManager.cloneNodeWithNewChildren")
    .flush();
  try {
    ReactShadowNode clone = node.mutableCopyWithNewChildren(node.getInstanceHandle());
    assertReactShadowNodeCopy(node, clone);
    return clone;
  } catch (Throwable t) {
    handleException(node, t);
    return null;
  } finally{
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
源代码4 项目: react-native-GPay   文件: FabricUIManager.java
/**
 * @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
 *     ReactShadowNode will contain a copy of all the internal data of the original node, but its
 *     props will be overridden with the {@link ReadableMap} received by parameter.
 */
@Nullable
@DoNotStrip
public ReactShadowNode cloneNodeWithNewProps(
    ReactShadowNode node, @Nullable ReadableNativeMap newProps) {
  if (DEBUG) {
    FLog.d(TAG, "cloneNodeWithNewProps \n\tnode: " + node + "\n\tprops: " + newProps);
  }
  SystraceMessage.beginSection(
    Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
    "FabricUIManager.cloneNodeWithNewProps")
    .flush();
  try {
    ReactShadowNode clone = node.mutableCopyWithNewProps(node.getInstanceHandle(),
          newProps == null ? null : new ReactStylesDiffMap(newProps));
    assertReactShadowNodeCopy(node, clone);
    return clone;
  } catch (Throwable t) {
    handleException(node, t);
    return null;
  } finally{
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
源代码5 项目: react-native-GPay   文件: FabricUIManager.java
/**
 * @return a clone of the {@link ReactShadowNode} received by parameter. The cloned
 *     ReactShadowNode will contain a copy of all the internal data of the original node, but its
 *     props will be overridden with the {@link ReadableMap} received by parameter and its
 *     children set will be empty.
 */
@Nullable
@DoNotStrip
public ReactShadowNode cloneNodeWithNewChildrenAndProps(
    ReactShadowNode node, ReadableNativeMap newProps) {
  if (DEBUG) {
    FLog.d(TAG, "cloneNodeWithNewChildrenAndProps \n\tnode: " + node + "\n\tnewProps: " + newProps);
  }
  SystraceMessage.beginSection(
    Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
    "FabricUIManager.cloneNodeWithNewChildrenAndProps")
    .flush();
  try {
    ReactShadowNode clone =
        node.mutableCopyWithNewChildrenAndProps(node.getInstanceHandle(),
            newProps == null ? null : new ReactStylesDiffMap(newProps));
    assertReactShadowNodeCopy(node, clone);
    return clone;
  } catch (Throwable t) {
    handleException(node, t);
    return null;
  } finally{
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
源代码6 项目: react-native-GPay   文件: FabricUIManager.java
/**
 * Appends the child {@link ReactShadowNode} to the children set of the parent {@link
 * ReactShadowNode}.
 */
@Nullable
@DoNotStrip
public void appendChild(ReactShadowNode parent, ReactShadowNode child) {
  if (DEBUG) {
    FLog.d(TAG, "appendChild \n\tparent: " + parent + "\n\tchild: " + child);
  }
  SystraceMessage.beginSection(
    Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
    "FabricUIManager.appendChild")
    .flush();
  try {
    // If the child to append was already committed (child.isSealed()),
    // then we add a mutation of it. In the future this will be performed by FabricJS / Fiber.
    //TODO: T27926878 avoid cloning shared child
    if (child.isSealed()) {
      child = child.mutableCopy(child.getInstanceHandle());
    }
    parent.addChildAt(child, parent.getChildCount());
  } catch (Throwable t) {
    handleException(parent, t);
  } finally{
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
源代码7 项目: react-native-GPay   文件: FabricUIManager.java
/**
 * Updates the root view size and re-render the RN surface.
 *
 * //TODO: change synchronization to integrate with new #render loop.
 */
private synchronized void updateRootSize(int rootTag, int newWidth, int newHeight) {
  ReactShadowNode rootNode = getRootNode(rootTag);
  if (rootNode == null) {
    FLog.w(
      ReactConstants.TAG,
      "Tried to update size of non-existent tag: " + rootTag);
    return;
  }

  ReactShadowNode newRootNode = rootNode.mutableCopy(rootNode.getInstanceHandle());
  int newWidthSpec = View.MeasureSpec.makeMeasureSpec(newWidth, View.MeasureSpec.EXACTLY);
  int newHeightSpec = View.MeasureSpec.makeMeasureSpec(newHeight, View.MeasureSpec.EXACTLY);
  updateRootView(newRootNode, newWidthSpec, newHeightSpec);

  completeRoot(rootTag, newRootNode.getChildrenList());
}
 
源代码8 项目: react-native-GPay   文件: FabricUIManagerTest.java
@Test
public void testSealReactShadowNode() {
  ReactRootView rootView =
    new ReactRootView(RuntimeEnvironment.application.getApplicationContext());
  int rootTag = mFabricUIManager.addRootView(rootView);
  String viewClass = ReactViewManager.REACT_CLASS;

  ReactShadowNode container = mFabricUIManager.createNode(6, viewClass, rootTag, null, randomInstanceHandle());
  List<ReactShadowNode> childSet = mFabricUIManager.createChildSet(rootTag);
  mFabricUIManager.appendChildToSet(childSet, container);

  assertThat(container.isSealed()).isFalse();

  mFabricUIManager.completeRoot(rootTag, childSet);

  assertThat(container.isSealed()).isTrue();
}
 
源代码9 项目: react-native-GPay   文件: FabricUIManagerTest.java
/**
 * Tests that cloned text nodes will not share measure functions
 */
@Test
public void testTextMutableClone() {
  ReactRootView rootView =
      new ReactRootView(RuntimeEnvironment.application.getApplicationContext());
  int rootTag = mFabricUIManager.addRootView(rootView);
  ReactShadowNode text =
      mFabricUIManager.createNode(0, ReactTextViewManager.REACT_CLASS, rootTag, null, randomInstanceHandle());
  assertThat(text.isMeasureDefined()).isTrue();

  ReactShadowNode textCopy = text.mutableCopy(randomInstanceHandle());
  assertThat(textCopy.isMeasureDefined()).isTrue();

  textCopy.setStyleWidth(200);
  text.onBeforeLayout();
  text.calculateLayout();
  textCopy.onBeforeLayout();
  textCopy.calculateLayout();

  assertThat(text.getLayoutWidth()).isNotEqualTo(textCopy.getLayoutWidth());
}
 
源代码10 项目: react-native-GPay   文件: FabricUIManagerTest.java
private void assertSameFields(ReactShadowNode node1, ReactShadowNode node2) {
  assertThat(node1.getReactTag()).isEqualTo(node2.getReactTag());
  assertThat(node1.getViewClass()).isEqualTo(node2.getViewClass());
  assertThat(node2.getParent()).isNull();
  assertThat(node1.getThemedContext()).isEqualTo(node2.getThemedContext());
  assertThat(node1.isVirtual()).isEqualTo(node2.isVirtual());
  assertThat(node1.getLayoutDirection()).isEqualTo(node2.getLayoutDirection());
  assertThat(node1.getLayoutHeight()).isEqualTo(node2.getLayoutHeight());
  assertThat(node1.getLayoutWidth()).isEqualTo(node2.getLayoutWidth());
  assertThat(node1.getLayoutX()).isEqualTo(node2.getLayoutX());
  assertThat(node1.getLayoutY()).isEqualTo(node2.getLayoutY());
  for (int spacingType = Spacing.LEFT; spacingType <= Spacing.ALL; spacingType++) {
    assertThat(node1.getStylePadding(spacingType)).isEqualTo(node2.getStylePadding(spacingType));
  }
  assertThat(node1.getStyleWidth()).isEqualTo(node2.getStyleWidth());
  assertThat(node1.getStyleHeight()).isEqualTo(node2.getStyleHeight());
}
 
源代码11 项目: react-native-GPay   文件: FabricReconcilerTest.java
@Test
public void testSimpleHierarchy() {
  ReactShadowNode parent = createNode(0);
  ReactShadowNode child1 = createNode(1);
  ReactShadowNode child2 = createNode(2);
  addChildren(parent, child1, child2);

  ReactShadowNode parentCloned = createNode(0);
  ReactShadowNode child3 = createNode(3);
  addChildren(parentCloned, child3, child2);

  mFabricReconciler.manageChildren(parent, parentCloned);

  List<ManageChildrenOperation> expectedOperations = new ArrayList<>();
  expectedOperations.add(
      new ManageChildrenOperation(
          0,
          new int[] {0, 1},
          new ViewAtIndex[] {new ViewAtIndex(3, 0), new ViewAtIndex(2, 1)},
          new int[] {1}));
  assertThat(mMockUIViewOperationQueue.getOperations()).isEqualTo(expectedOperations);
}
 
源代码12 项目: react-native-GPay   文件: FabricReconcilerTest.java
@Test
public void testVirtualNodes() {
  ReactShadowNode parent = createNode(0);
  ReactShadowNode child1 = createVirtualNode(1);
  ReactShadowNode child2 = createVirtualNode(2);
  ReactShadowNode child3 = createVirtualNode(3);
  addChildren(parent, child1, child2, child3);

  ReactShadowNode parentCloned = createNode(0);
  ReactShadowNode child4 = createVirtualNode(4);
  addChildren(parentCloned, child1, child4, child3);

  mFabricReconciler.manageChildren(parent, parentCloned);

  List<ManageChildrenOperation> expectedOperations = new ArrayList<>();
  assertThat(mMockUIViewOperationQueue.getOperations()).isEqualTo(expectedOperations);
}
 
源代码13 项目: art   文件: ARTRenderableViewManager.java
@Override
public ReactShadowNode createShadowNodeInstance() {
  if (CLASS_GROUP.equals(mClassName)) {
    return new ARTGroupShadowNode();
  } else if (CLASS_SHAPE.equals(mClassName)) {
    return new ARTShapeShadowNode();
  } else if (CLASS_TEXT.equals(mClassName)) {
    return new ARTTextShadowNode();
  } else {
    throw new IllegalStateException("Unexpected type " + mClassName);
  }
}
 
源代码14 项目: art   文件: ARTRenderableViewManager.java
@Override
public Class<? extends ReactShadowNode> getShadowNodeClass() {
  if (CLASS_GROUP.equals(mClassName)) {
    return ARTGroupShadowNode.class;
  } else if (CLASS_SHAPE.equals(mClassName)) {
    return ARTShapeShadowNode.class;
  } else if (CLASS_TEXT.equals(mClassName)) {
    return ARTTextShadowNode.class;
  } else {
    throw new IllegalStateException("Unexpected type " + mClassName);
  }
}
 
源代码15 项目: art   文件: ARTSurfaceViewShadowNode.java
private void markChildrenUpdatesSeen(ReactShadowNode shadowNode) {
  for (int i = 0; i < shadowNode.getChildCount(); i++) {
    ReactShadowNode child = shadowNode.getChildAt(i);
    child.markUpdateSeen();
    markChildrenUpdatesSeen(child);
  }
}
 
@Override
public ReactShadowNode createShadowNodeInstance() {
  if (CLASS_GROUP.equals(mClassName)) {
    return new ARTGroupShadowNode();
  } else if (CLASS_SHAPE.equals(mClassName)) {
    return new ARTShapeShadowNode();
  } else if (CLASS_TEXT.equals(mClassName)) {
    return new ARTTextShadowNode();
  } else {
    throw new IllegalStateException("Unexpected type " + mClassName);
  }
}
 
@Override
public Class<? extends ReactShadowNode> getShadowNodeClass() {
  if (CLASS_GROUP.equals(mClassName)) {
    return ARTGroupShadowNode.class;
  } else if (CLASS_SHAPE.equals(mClassName)) {
    return ARTShapeShadowNode.class;
  } else if (CLASS_TEXT.equals(mClassName)) {
    return ARTTextShadowNode.class;
  } else {
    throw new IllegalStateException("Unexpected type " + mClassName);
  }
}
 
private void markChildrenUpdatesSeen(ReactShadowNode shadowNode) {
  for (int i = 0; i < shadowNode.getChildCount(); i++) {
    ReactShadowNode child = shadowNode.getChildAt(i);
    child.markUpdateSeen();
    markChildrenUpdatesSeen(child);
  }
}
 
源代码19 项目: react-native-GPay   文件: FabricReconciler.java
public void manageChildren(ReactShadowNode previousRootShadowNode, ReactShadowNode newRootShadowNode) {
  SystraceMessage.beginSection(
    Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
    "FabricReconciler.manageChildren")
    .flush();

  try {
    List<ReactShadowNode> prevList =
      previousRootShadowNode == null ? null :  previousRootShadowNode.getChildrenList();
    manageChildren(newRootShadowNode, prevList, newRootShadowNode.getChildrenList());
  } finally{
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
源代码20 项目: react-native-GPay   文件: FabricUIManager.java
/** Creates a new {@link ReactShadowNode} */
@Nullable
@DoNotStrip
public ReactShadowNode createNode(
    int reactTag, String viewName, int rootTag, ReadableNativeMap props, long eventTarget) {
  if (DEBUG) {
    FLog.d(TAG, "createNode \n\ttag: " + reactTag +
        "\n\tviewName: " + viewName +
        "\n\trootTag: " + rootTag +
        "\n\tprops: " + props);
  }
  try {
    ViewManager viewManager = mViewManagerRegistry.get(viewName);
    ReactShadowNode node = viewManager.createShadowNodeInstance(mReactApplicationContext);
    ReactShadowNode rootNode = getRootNode(rootTag);
    node.setRootTag(rootNode.getReactTag());
    node.setViewClassName(viewName);
    node.setInstanceHandle(eventTarget);
    node.setReactTag(reactTag);
    node.setThemedContext(rootNode.getThemedContext());

    ReactStylesDiffMap styles = updateProps(node, props);

    if (!node.isVirtual()) {
      mUIViewOperationQueue.enqueueCreateView(
          rootNode.getThemedContext(), reactTag, viewName, styles);
    }
    return node;
  } catch (Throwable t) {
    handleException(getRootNode(rootTag), t);
    return null;
  }
}
 
源代码21 项目: react-native-GPay   文件: FabricUIManager.java
private ReactStylesDiffMap updateProps(ReactShadowNode node, @Nullable ReadableNativeMap props) {
  ReactStylesDiffMap styles = null;
  if (props != null) {
    styles = new ReactStylesDiffMap(props);
    node.updateProperties(styles);
  }
  return styles;
}
 
源代码22 项目: react-native-GPay   文件: FabricUIManager.java
private void assertReactShadowNodeCopy(ReactShadowNode source, ReactShadowNode target) {
  Assertions.assertCondition(
      source.getClass().equals(target.getClass()),
      "Found "
          + target.getClass()
          + " class when expecting: "
          + source.getClass()
          + ". Check that "
          + source.getClass()
          + " implements the copy() method correctly.");
}
 
源代码23 项目: react-native-GPay   文件: FabricUIManager.java
/**
 * @return an empty {@link List<ReactShadowNode>} that will be used to append the {@link
 *     ReactShadowNode} elements of the root. Typically this List will contain one element.
 */
@DoNotStrip
public List<ReactShadowNode> createChildSet(int rootTag) {
  if (DEBUG) {
    FLog.d(TAG, "createChildSet rootTag: " + rootTag);
  }
  return new ArrayList<>(1);
}
 
源代码24 项目: react-native-GPay   文件: FabricUIManager.java
@DoNotStrip
public synchronized void completeRoot(int rootTag, @Nullable List<ReactShadowNode> childList) {
  SystraceMessage.beginSection(
    Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
    "FabricUIManager.completeRoot")
    .flush();
  try {
    long startTime = SystemClock.uptimeMillis();
    childList = childList == null ? new LinkedList<ReactShadowNode>() : childList;
    if (DEBUG) {
      FLog.d(TAG, "completeRoot rootTag: " + rootTag + ", childList: " + childList);
    }
    ReactShadowNode currentRootShadowNode = getRootNode(rootTag);
    Assertions.assertNotNull(
        currentRootShadowNode,
        "Root view with tag " + rootTag + " must be added before completeRoot is called");

    currentRootShadowNode = calculateDiffingAndCreateNewRootNode(currentRootShadowNode, childList);

    if (DEBUG) {
      FLog.d(
        TAG,
        "ReactShadowNodeHierarchy after diffing: " + currentRootShadowNode.getHierarchyInfo());
    }

    applyUpdatesRecursive(currentRootShadowNode);
    mUIViewOperationQueue.dispatchViewUpdates(
      mCurrentBatch++, startTime, mLastCalculateLayoutTime);

    mRootShadowNodeRegistry.replaceNode(currentRootShadowNode);
  } catch (Exception e) {
    handleException(getRootNode(rootTag), e);
  } finally{
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
源代码25 项目: react-native-GPay   文件: FabricUIManager.java
private void notifyOnBeforeLayoutRecursive(ReactShadowNode node) {
  if (!node.hasUpdates()) {
    return;
  }
  for (int i = 0; i < node.getChildCount(); i++) {
    notifyOnBeforeLayoutRecursive(node.getChildAt(i));
  }
  node.onBeforeLayout();
}
 
源代码26 项目: react-native-GPay   文件: FabricUIManager.java
private ReactShadowNode calculateDiffingAndCreateNewRootNode(
    ReactShadowNode currentRootShadowNode, List<ReactShadowNode> newChildList) {
  SystraceMessage.beginSection(
    Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
    "FabricUIManager.calculateDiffingAndCreateNewRootNode")
    .flush();
  try {
    ReactShadowNode newRootShadowNode = currentRootShadowNode.mutableCopyWithNewChildren(currentRootShadowNode.getInstanceHandle());
    for (ReactShadowNode child : newChildList) {
      appendChild(newRootShadowNode, child);
    }

    if (DEBUG) {
      FLog.d(
        TAG,
        "ReactShadowNodeHierarchy before calculateLayout: " + newRootShadowNode.getHierarchyInfo());
    }

    notifyOnBeforeLayoutRecursive(newRootShadowNode);

    calculateLayout(newRootShadowNode);

    if (DEBUG) {
      FLog.d(
        TAG,
        "ReactShadowNodeHierarchy after calculateLayout: " + newRootShadowNode.getHierarchyInfo());
    }

    mFabricReconciler.manageChildren(currentRootShadowNode, newRootShadowNode);
    return newRootShadowNode;
  } finally{
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
源代码27 项目: react-native-GPay   文件: FabricUIManager.java
private void calculateLayout(ReactShadowNode newRootShadowNode) {
  SystraceMessage.beginSection(
    Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
    "FabricUIManager.calculateLayout")
    .flush();
  long startTime = SystemClock.uptimeMillis();
  try {
    newRootShadowNode.calculateLayout();
  } finally{
    mLastCalculateLayoutTime = SystemClock.uptimeMillis() - startTime;
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
源代码28 项目: react-native-GPay   文件: FabricUIManager.java
private void applyUpdatesRecursive(ReactShadowNode node) {
  SystraceMessage.beginSection(
          Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricUIManager.applyUpdatesRecursive")
      .flush();
  try {
    applyUpdatesRecursive(node, 0, 0);
  } finally{
    SystraceMessage.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
源代码29 项目: react-native-GPay   文件: FabricUIManager.java
private void applyUpdatesRecursive(ReactShadowNode node, float absoluteX, float absoluteY) {
  if (!node.hasUpdates()) {
    return;
  }

  if (!node.isVirtualAnchor()) {
    for (int i = 0; i < node.getChildCount(); i++) {
      applyUpdatesRecursive(
          node.getChildAt(i),
          absoluteX + node.getLayoutX(),
          absoluteY + node.getLayoutY());
    }
  }

  int tag = node.getReactTag();
  if (getRootNode(tag) == null) {
    boolean frameDidChange =
        node.dispatchUpdates(absoluteX, absoluteY, mUIViewOperationQueue, null);
    // Notify JS about layout event if requested
    // and if the position or dimensions actually changed
    // (consistent with iOS and Android Default implementation).
    if (frameDidChange && node.shouldNotifyOnLayout()) {
      mUIViewOperationQueue.enqueueOnLayoutEvent(tag,
        node.getScreenX(),
        node.getScreenY(),
        node.getScreenWidth(),
        node.getScreenHeight());
    }
  }

  // Set the reference to the OriginalReactShadowNode to NULL, as the tree is already committed
  // and we do not need to hold references to the previous tree anymore
  node.setOriginalReactShadowNode(null);
  node.markUpdateSeen();
  node.markAsSealed();
}
 
源代码30 项目: react-native-GPay   文件: FabricUIManager.java
@Override
@DoNotStrip
public <T extends SizeMonitoringFrameLayout & MeasureSpecProvider> int addRootView(
    final T rootView) {

  SystraceMessage.beginSection(
    Systrace.TRACE_TAG_REACT_JAVA_BRIDGE,
    "FabricUIManager.addRootView")
    .flush();
  try {
    final int rootTag = ReactRootViewTagGenerator.getNextRootViewTag();
    ThemedReactContext themedRootContext =
        new ThemedReactContext(mReactApplicationContext, rootView.getContext());

    ReactShadowNode rootShadowNode = createRootShadowNode(rootTag, themedRootContext);

    int widthMeasureSpec = rootView.getWidthMeasureSpec();
    int heightMeasureSpec = rootView.getHeightMeasureSpec();
    updateRootView(rootShadowNode, widthMeasureSpec, heightMeasureSpec);

    rootView.setOnSizeChangedListener(
      new SizeMonitoringFrameLayout.OnSizeChangedListener() {
        @Override
        public void onSizeChanged(final int width, final int height, int oldW, int oldH) {
          updateRootSize(rootTag, width, height);
        }
      });

    mRootShadowNodeRegistry.registerNode(rootShadowNode);
    mUIViewOperationQueue.addRootView(rootTag, rootView, themedRootContext);
    return rootTag;
  } finally{
    Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
  }
}
 
 类所在包
 同包方法