feat:should receive multi onRenderFinishedCallbacks
This commit is contained in:
@@ -49,7 +49,7 @@ export function coordinator(context: BridgeContext) {
|
||||
}) => {
|
||||
if (context.entity instanceof Panel) {
|
||||
const panel = context.entity
|
||||
panel.onRenderFinished = () => {
|
||||
panel.addOnRenderFinishedCallback(() => {
|
||||
(argument as any).scrollable = viewIdChains(argument.scrollable)
|
||||
if (argument.target instanceof View) {
|
||||
(argument as any).target = viewIdChains(argument.target)
|
||||
@@ -60,8 +60,8 @@ export function coordinator(context: BridgeContext) {
|
||||
if (argument.changing.end instanceof Color) {
|
||||
argument.changing.end = argument.changing.end.toModel()
|
||||
}
|
||||
return context.callNative("coordinator", "verticalScrolling", argument)
|
||||
}
|
||||
context.callNative("coordinator", "verticalScrolling", argument)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -45,7 +45,7 @@ export abstract class Panel {
|
||||
private __root__ = new Root
|
||||
private headviews: Map<string, Map<string, View>> = new Map
|
||||
|
||||
onRenderFinished?: () => void
|
||||
private onRenderFinishedCallback: Array<() => void> = []
|
||||
|
||||
addHeadView(type: string, v: View) {
|
||||
let map = this.headviews.get(type)
|
||||
@@ -209,9 +209,17 @@ export abstract class Panel {
|
||||
})
|
||||
}
|
||||
Promise.all(promises).then(_ => {
|
||||
if (this.onRenderFinished) {
|
||||
this.onRenderFinished()
|
||||
}
|
||||
this.onRenderFinished()
|
||||
})
|
||||
}
|
||||
onRenderFinished() {
|
||||
this.onRenderFinishedCallback.forEach(e => {
|
||||
e()
|
||||
})
|
||||
this.onRenderFinishedCallback.length = 0
|
||||
}
|
||||
|
||||
addOnRenderFinishedCallback(cb: () => void) {
|
||||
this.onRenderFinishedCallback.push(cb)
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user