下面列出了com.facebook.react.uimanager.ReactShadowNode#getChildCount ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
private void markChildrenUpdatesSeen(ReactShadowNode shadowNode) {
for (int i = 0; i < shadowNode.getChildCount(); i++) {
ReactShadowNode child = shadowNode.getChildAt(i);
child.markUpdateSeen();
markChildrenUpdatesSeen(child);
}
}
private void markChildrenUpdatesSeen(ReactShadowNode shadowNode) {
for (int i = 0; i < shadowNode.getChildCount(); i++) {
ReactShadowNode child = shadowNode.getChildAt(i);
child.markUpdateSeen();
markChildrenUpdatesSeen(child);
}
}
private void notifyOnBeforeLayoutRecursive(ReactShadowNode node) {
if (!node.hasUpdates()) {
return;
}
for (int i = 0; i < node.getChildCount(); i++) {
notifyOnBeforeLayoutRecursive(node.getChildAt(i));
}
node.onBeforeLayout();
}
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();
}
private void assertSameChildren(ReactShadowNode node1, ReactShadowNode node2) {
assertThat(node1.getChildCount()).isEqualTo(node2.getChildCount());
for (int i = 0; i < node1.getChildCount(); i++) {
assertThat(node1.getChildAt(i)).isEqualTo(node2.getChildAt(i));
}
}