private void addNonLayoutOnlyNodeToLayoutOnlyNode( ReactShadowNode layoutOnlyNode, ReactShadowNode nonLayoutOnlyNode, int index) { ReactShadowNode parent = layoutOnlyNode.getParent(); // If the parent hasn't been attached to its parent yet, don't issue commands to the native // hierarchy. We'll do that when the parent node actually gets attached somewhere. if (parent == null) { return; } int transformedIndex = index + parent.getNativeOffsetForChild(layoutOnlyNode); if (parent.isLayoutOnly()) { addNonLayoutOnlyNodeToLayoutOnlyNode(parent, nonLayoutOnlyNode, transformedIndex); } else { addNonLayoutNodeToNonLayoutNode(parent, nonLayoutOnlyNode, transformedIndex); } }
private void addNodeToNode(ReactShadowNode parent, ReactShadowNode child, int index) { int indexInNativeChildren = parent.getNativeOffsetForChild(parent.getChildAt(index)); boolean parentIsLayoutOnly = parent.isLayoutOnly(); boolean childIsLayoutOnly = child.isLayoutOnly(); // Switch on the four cases of: // add (layout-only|not layout-only) to (layout-only|not layout-only) if (!parentIsLayoutOnly && !childIsLayoutOnly) { addNonLayoutNodeToNonLayoutNode(parent, child, indexInNativeChildren); } else if (!childIsLayoutOnly) { addNonLayoutOnlyNodeToLayoutOnlyNode(parent, child, indexInNativeChildren); } else if (!parentIsLayoutOnly) { addLayoutOnlyNodeToNonLayoutOnlyNode(parent, child, indexInNativeChildren); } else { addLayoutOnlyNodeToLayoutOnlyNode(parent, child, indexInNativeChildren); } }