Improve error messages when nesting View in Text

Summary: Since we don't support this, we should throw early. Also tries to improve the error message when adding a node that doesn't have a YogaNode to a node that can't measure itself.

Reviewed By: andreicoman11

Differential Revision: D4421542

fbshipit-source-id: e0be8cdd763091145e5e6af2db91515f4d236b37
This commit is contained in:
Andy Street
2017-01-18 09:18:20 -08:00
committed by Facebook Github Bot
parent 76c4faee5e
commit 963e6e9d36
2 changed files with 13 additions and 1 deletions

View File

@@ -167,7 +167,9 @@ public class ReactShadowNode {
YogaNode childYogaNode = child.mYogaNode;
if (childYogaNode == null) {
throw new RuntimeException(
"Cannot add a child that doesn't have a CSS node to a node without a measure function!");
"Cannot add a child that doesn't have a YogaNode to a parent without a measure " +
"function! (Trying to add a '" + child.getClass().getSimpleName() + "' to a '" +
getClass().getSimpleName() + "')");
}
mYogaNode.addChildAt(childYogaNode, i);
}