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);
|
super.onDismiss(dialog);
|
||||||
const manager = this.getFragmentManager();
|
const manager = this.getFragmentManager();
|
||||||
if (manager) {
|
if (manager) {
|
||||||
const owner = this.owner;
|
removeModal(this.owner._domId);
|
||||||
removeModal(owner._domId);
|
|
||||||
this._dismissCallback();
|
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;
|
DialogFragment = DialogFragmentImpl;
|
||||||
|
|||||||
@@ -208,10 +208,6 @@ export class FrameBase extends CustomLayoutView implements FrameDefinition {
|
|||||||
return this._currentEntry === entry;
|
return this._currentEntry === entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
public changeEntry(entry: BackstackEntry): void {
|
|
||||||
// android specific.
|
|
||||||
}
|
|
||||||
|
|
||||||
public setCurrent(entry: BackstackEntry, isBack: boolean): void {
|
public setCurrent(entry: BackstackEntry, isBack: boolean): void {
|
||||||
const newPage = entry.resolvedPage;
|
const newPage = entry.resolvedPage;
|
||||||
// In case we navigated forward to a page that was in the backstack
|
// In case we navigated forward to a page that was in the backstack
|
||||||
|
|||||||
@@ -170,12 +170,6 @@ export class Frame extends FrameBase {
|
|||||||
return newFragment;
|
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 {
|
public setCurrent(entry: BackstackEntry, isBack: boolean): void {
|
||||||
const current = this._currentEntry;
|
const current = this._currentEntry;
|
||||||
const currentEntryChanged = current !== entry;
|
const currentEntryChanged = current !== entry;
|
||||||
@@ -189,12 +183,10 @@ export class Frame extends FrameBase {
|
|||||||
if (this._tearDownPending) {
|
if (this._tearDownPending) {
|
||||||
this._tearDownPending = false;
|
this._tearDownPending = false;
|
||||||
if (!entry.recreated) {
|
if (!entry.recreated) {
|
||||||
entry.recreated = false;
|
|
||||||
clearEntry(entry);
|
clearEntry(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current && !current.recreated) {
|
if (current && !current.recreated) {
|
||||||
current.recreated = false;
|
|
||||||
clearEntry(current);
|
clearEntry(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,6 +197,9 @@ export class Frame extends FrameBase {
|
|||||||
entry.fragment = this.createFragment(entry, entry.fragmentTag);
|
entry.fragment = this.createFragment(entry, entry.fragmentTag);
|
||||||
entry.resolvedPage._setupUI(context);
|
entry.resolvedPage._setupUI(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entry.recreated = false;
|
||||||
|
current.recreated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
super.setCurrent(entry, isBack);
|
super.setCurrent(entry, isBack);
|
||||||
@@ -402,6 +397,7 @@ function clearEntry(entry: BackstackEntry): void {
|
|||||||
_clearFragment(entry);
|
_clearFragment(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
entry.recreated = false;
|
||||||
entry.fragment = null;
|
entry.fragment = null;
|
||||||
const page = entry.resolvedPage;
|
const page = entry.resolvedPage;
|
||||||
if (page._context) {
|
if (page._context) {
|
||||||
|
|||||||
@@ -261,6 +261,11 @@ export class TabViewItem extends TabViewItemBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public disposeNativeView(): void {
|
||||||
|
super.disposeNativeView();
|
||||||
|
(<TabViewItemDefinition>this).canBeLoaded = false;
|
||||||
|
}
|
||||||
|
|
||||||
public createNativeView() {
|
public createNativeView() {
|
||||||
return this.nativeViewProtected;
|
return this.nativeViewProtected;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user