mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 21:01:34 +08:00
fix(modal): Fix crash if modal is destroyed before dismissed in Android (#6723)
This commit is contained in:

committed by
GitHub

parent
36f289b9a5
commit
8a32102fa1
@ -195,8 +195,17 @@ function initializeDialogFragment() {
|
|||||||
public onDestroy(): void {
|
public onDestroy(): void {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
const owner = this.owner;
|
const owner = this.owner;
|
||||||
owner._isAddedToNativeVisualTree = false;
|
|
||||||
owner._tearDownUI(true);
|
if (owner) {
|
||||||
|
// Android calls onDestroy before onDismiss.
|
||||||
|
// Make sure we unload first and then call _tearDownUI.
|
||||||
|
if (owner.isLoaded) {
|
||||||
|
owner.callUnloaded();
|
||||||
|
}
|
||||||
|
|
||||||
|
owner._isAddedToNativeVisualTree = false;
|
||||||
|
owner._tearDownUI(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user