fix iOS crash when call Destory

This commit is contained in:
pengfei.zhou
2020-05-06 17:34:48 +08:00
committed by osborn
parent c9c99cce06
commit 7828b24cd5
12 changed files with 43 additions and 2 deletions

View File

@@ -33,6 +33,7 @@ type Frame = { width: number, height: number }
declare function nativeEmpty(): void
export abstract class Panel {
private destroyed = false
context!: BridgeContext
onCreate() { }
onDestroy() { }
@@ -103,6 +104,7 @@ export abstract class Panel {
@NativeCall
private __onDestroy__() {
this.destroyed = true
this.onDestroy()
}
@@ -175,6 +177,9 @@ export abstract class Panel {
}
private hookAfterNativeCall() {
if (this.destroyed) {
return
}
const promises: Promise<any>[] = []
if (Environment.platform !== 'web') {
//Here insert a native call to ensure the promise is resolved done.