Merge pull request #2539 from NativeScript/action-items-exception

Element that isn't a View should not be added to its parent
This commit is contained in:
Maya Zhecheva
2016-08-01 17:22:55 +03:00
committed by GitHub

View File

@@ -988,7 +988,10 @@ export class View extends ProxyObject implements definition.View {
if (!view) {
throw new Error("Expecting a valid View instance.");
}
if(!(view instanceof View))
{
throw new Error(view + " is not a valid View instance.");
}
if (view._parent) {
throw new Error("View already has a parent. View: " + view + " Parent: " + view._parent);
}