Skip to content

Commit

Permalink
feat(ohos): fix HippyCustomComponentView position
Browse files Browse the repository at this point in the history
  • Loading branch information
sohotz committed Sep 25, 2024
1 parent 51a22a6 commit 914e55c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ export class ExampleViewA extends HippyCustomComponentView {
return super.setProp(propKey, propValue)
}

updateRenderViewFrame(frame: HRRect, padding: HRPadding | null): void {
// For c api, the position is used by container node.
if (this.ctx.getNativeRender().isEnableArkCApi()) {
this.cssPositionX = 0
this.cssPositionY = 0
} else {
this.cssPositionX = frame.x
this.cssPositionY = frame.y
}
this.cssWidth = frame.width
this.cssHeight = frame.height
}

call(method: string, params: Array<HippyAny>, callback: HippyRenderCallback | null): void {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,6 @@ export class ExampleViewB extends HippyCustomComponentView {
return super.setProp(propKey, propValue)
}

updateRenderViewFrame(frame: HRRect, padding: HRPadding | null): void {
// For c api, the position is used by container node.
if (this.ctx.getNativeRender().isEnableArkCApi()) {
this.cssPositionX = 0
this.cssPositionY = 0
} else {
this.cssPositionX = frame.x
this.cssPositionY = frame.y
}
this.cssWidth = frame.width
this.cssHeight = frame.height
}

call(method: string, params: Array<HippyAny>, callback: HippyRenderCallback | null): void {

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import { HippyAny, HippyRenderCallback } from '../../../support/common/HippyTypes'
import { NativeRenderContext } from '../../NativeRenderContext'
import { HRMeasureMode, HRMeasureResult } from '../../utils/HRMeasure'
import { HRPadding, HRRect } from '../../utils/HRTypes'
import HippyRenderBaseView from '../base/HippyRenderBaseView'

export class HippyCustomComponentView extends HippyRenderBaseView {
Expand All @@ -31,6 +32,19 @@ export class HippyCustomComponentView extends HippyRenderBaseView {
return super.setProp(propKey, propValue)
}

updateRenderViewFrame(frame: HRRect, padding: HRPadding | null): void {
// For c api, the position is used by container node.
if (this.ctx.getNativeRender().isEnableArkCApi()) {
this.cssPositionX = 0
this.cssPositionY = 0
} else {
this.cssPositionX = frame.x
this.cssPositionY = frame.y
}
this.cssWidth = frame.width
this.cssHeight = frame.height
}

call(method: string, params: Array<HippyAny>, callback: HippyRenderCallback | null): void {

}
Expand Down

0 comments on commit 914e55c

Please sign in to comment.