Add Fabric test for text nodes

Reviewed By: mdvacca

Differential Revision: D7165356

fbshipit-source-id: ab5b019943d0d6f759bdb16ca646e34a2ef79e23
This commit is contained in:
Andrew Chen (Eng) 2018-03-06 16:04:41 -08:00 committed by Facebook Github Bot
parent 2e51fa5f5d
commit e7b8341024
1 changed files with 23 additions and 8 deletions

View File

@ -70,8 +70,10 @@ public class FabricUIManager implements UIManager {
ReactStylesDiffMap styles = updateProps(node, props);
mUIViewOperationQueue
.enqueueCreateView(rootNode.getThemedContext(), reactTag, viewName, styles);
if (!node.isVirtual()) {
mUIViewOperationQueue
.enqueueCreateView(rootNode.getThemedContext(), reactTag, viewName, styles);
}
return node;
} catch (Throwable t) {
handleException(getRootNode(rootTag), t);
@ -184,12 +186,14 @@ public class FabricUIManager implements UIManager {
parent.addChildAt(child, childIndex);
ViewAtIndex[] viewsToAdd =
new ViewAtIndex[]{new ViewAtIndex(child.getReactTag(), childIndex)};
mUIViewOperationQueue.enqueueManageChildren(
parent.getReactTag(),
null,
viewsToAdd,
null
);
if (!child.isVirtual()) {
mUIViewOperationQueue.enqueueManageChildren(
parent.getReactTag(),
null,
viewsToAdd,
null
);
}
} catch (Throwable t) {
handleException(parent, t);
}
@ -221,6 +225,7 @@ public class FabricUIManager implements UIManager {
appendChild(rootNode, child);
}
notifyOnBeforeLayoutRecursive(rootNode);
calculateRootLayout(rootNode);
applyUpdatesRecursive(rootNode, 0, 0);
mUIViewOperationQueue
@ -230,6 +235,16 @@ public class FabricUIManager implements UIManager {
}
}
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 calculateRootLayout(ReactShadowNode cssRoot) {
cssRoot.calculateLayout();
}