HarmonyOS 在RN端的LottieVIew没能渲染在正确的位置上?

在RN开发HarmonyOS端应用,使用了lottieView组件渲染,但是没有能按照预期渲染在正确的位置上。

阅读 550
1 个回答

解决方式有两种:

1、在buildCustomComponent,将组件包裹在 Stack() 标签内,并且设置position({ x: 0, y: 0 })。

2、是升级RNOH 版本至500。

buildCustomComponent具体代码如下:

@Builder
export function buildCustomComponent(ctx: ComponentBuilderContext) {
  Stack() {
    if (ctx.componentName === LOTTIE_TYPE) {
      LottieAnimationView({
        ctx: ctx.rnComponentContext,
        tag: ctx.tag
      })
    }
  }
  .position({ x: 0, y: 0 })
}
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进