Fixed crash when ListView is used in a modal dialog (Android).

This commit is contained in:
Nedyalko Nikolov
2016-06-07 14:27:44 +03:00
parent 743a2efb4a
commit 98a9680bce
2 changed files with 42 additions and 6 deletions

View File

@@ -108,7 +108,10 @@ export class ListView extends common.ListView {
callback(view);
}
else {
callback(view.parent);
// in some cases (like item is unloaded from another place (like angular) view.parent becomes undefined)
if (view.parent) {
callback(view.parent);
}
}
});
}
@@ -124,12 +127,13 @@ export class ListView extends common.ListView {
private clearRealizedCells(): void {
// clear the cache
this._realizedItems.forEach((view, nativeView, map) => {
// This is to clear the StackLayout that is used to wrap non LayoutBase & ProxyViewContainer instances.
if (!(view.parent instanceof ListView)) {
this._removeView(view.parent);
if (view.parent) {
// This is to clear the StackLayout that is used to wrap non LayoutBase & ProxyViewContainer instances.
if (!(view.parent instanceof ListView)) {
this._removeView(view.parent);
}
view.parent._removeView(view);
}
view.parent._removeView(view);
});
this._realizedItems.clear();