mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 20:11:24 +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 {
|
||||
super.onDestroy();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -386,7 +395,7 @@ export class View extends ViewCommon {
|
||||
if (!this.nativeViewProtected || !this.hasGestureObservers()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// do not set noop listener that handles the event (disabled listener) if IsUserInteractionEnabled is
|
||||
// false as we might need the ability for the event to pass through to a parent view
|
||||
initializeTouchListener();
|
||||
|
Reference in New Issue
Block a user