Fix android crash TabViewItem canBeLoaded was true even when TabView was destroyed

Fix android crash modal view was not destroyed even though his dialog was
This commit is contained in:
Hristo Hristov
2017-12-14 13:37:56 +02:00
parent 365d48550f
commit 4e74c37313
4 changed files with 18 additions and 17 deletions

View File

@@ -187,14 +187,18 @@ function initializeDialogFragment() {
super.onDismiss(dialog);
const manager = this.getFragmentManager();
if (manager) {
const owner = this.owner;
removeModal(owner._domId);
removeModal(this.owner._domId);
this._dismissCallback();
}
}
public onDestroy(): void {
super.onDestroy();
const owner = this.owner;
owner._isAddedToNativeVisualTree = false;
owner._tearDownUI(true);
}
}
}
DialogFragment = DialogFragmentImpl;
}

View File

@@ -208,10 +208,6 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
return this._currentEntry === entry;
}
public changeEntry(entry: BackstackEntry): void {
// android specific.
}
public setCurrent(entry: BackstackEntry, isBack: boolean): void {
const newPage = entry.resolvedPage;
// In case we navigated forward to a page that was in the backstack

View File

@@ -170,12 +170,6 @@ export class Frame extends FrameBase {
return newFragment;
}
public changeEntry(entry: BackstackEntry): void {
const isBack = this._isBack;
this.setCurrent(entry, isBack);
this._isBack = true;
}
public setCurrent(entry: BackstackEntry, isBack: boolean): void {
const current = this._currentEntry;
const currentEntryChanged = current !== entry;
@@ -189,12 +183,10 @@ export class Frame extends FrameBase {
if (this._tearDownPending) {
this._tearDownPending = false;
if (!entry.recreated) {
entry.recreated = false;
clearEntry(entry);
}
if (current && !current.recreated) {
current.recreated = false;
clearEntry(current);
}
@@ -205,6 +197,9 @@ export class Frame extends FrameBase {
entry.fragment = this.createFragment(entry, entry.fragmentTag);
entry.resolvedPage._setupUI(context);
}
entry.recreated = false;
current.recreated = false;
}
super.setCurrent(entry, isBack);
@@ -402,6 +397,7 @@ function clearEntry(entry: BackstackEntry): void {
_clearFragment(entry);
}
entry.recreated = false;
entry.fragment = null;
const page = entry.resolvedPage;
if (page._context) {

View File

@@ -261,6 +261,11 @@ export class TabViewItem extends TabViewItemBase {
}
}
public disposeNativeView(): void {
super.disposeNativeView();
(<TabViewItemDefinition>this).canBeLoaded = false;
}
public createNativeView() {
return this.nativeViewProtected;
}