Skip to content

Commit

Permalink
feat(ohos): fix update virtual node before measure text (Tencent#19)
Browse files Browse the repository at this point in the history
Co-authored-by: chenxun <[email protected]>
  • Loading branch information
2 people authored and sohotz committed May 14, 2024
1 parent 382feff commit 2b42ff8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion framework/ohos/src/main/ets/renderer_native/NativeRenderImpl.ets
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import TextMeasurer from "@ohos.measure"
import { HippyException } from '../support/common/HippyException'
import { HippyExecutor } from '../support/common/HippyExecutor'
import { HippyAny, HippyMap, HippyRenderCallback } from '../support/common/HippyTypes'
import { HippyAny, HippyMap, HippyValue, HippyRenderCallback } from '../support/common/HippyTypes'
import { LogUtils } from '../support/utils/LogUtils'
import { VfsManager } from '../vfs/VfsManager'
import { ImageDecoderAdapter } from './components/image/ImageDecoderAdapter'
Expand Down Expand Up @@ -202,6 +202,16 @@ export class NativeRenderImpl implements NativeRender {
updateNode(rootId: number, nodeList: Array<HippyAny>) {
for (let i = 0; i < nodeList.length; i++) {
let node = nodeList[i] as Map<string, HippyAny>

let vNode = this.virtualNodes.get(node.get('id') as number)
if (vNode && vNode.props) {
(node.get('props') as HippyMap).forEach((value: HippyValue, key: string) => {
if (vNode && vNode.props && key && value) {
vNode.props.set(key, value)
}
})
}

let m: HRUpdateMutation = new HRUpdateMutation()
m.viewName = node.get('name') as string
m.tag = node.get('id') as number
Expand Down

0 comments on commit 2b42ff8

Please sign in to comment.