mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
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:
@@ -187,13 +187,17 @@ function initializeDialogFragment() {
|
||||
super.onDismiss(dialog);
|
||||
const manager = this.getFragmentManager();
|
||||
if (manager) {
|
||||
const owner = this.owner;
|
||||
removeModal(owner._domId);
|
||||
removeModal(this.owner._domId);
|
||||
this._dismissCallback();
|
||||
owner._isAddedToNativeVisualTree = false;
|
||||
owner._tearDownUI(true);
|
||||
}
|
||||
}
|
||||
|
||||
public onDestroy(): void {
|
||||
super.onDestroy();
|
||||
const owner = this.owner;
|
||||
owner._isAddedToNativeVisualTree = false;
|
||||
owner._tearDownUI(true);
|
||||
}
|
||||
}
|
||||
|
||||
DialogFragment = DialogFragmentImpl;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -261,6 +261,11 @@ export class TabViewItem extends TabViewItemBase {
|
||||
}
|
||||
}
|
||||
|
||||
public disposeNativeView(): void {
|
||||
super.disposeNativeView();
|
||||
(<TabViewItemDefinition>this).canBeLoaded = false;
|
||||
}
|
||||
|
||||
public createNativeView() {
|
||||
return this.nativeViewProtected;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user