HarmonyOS RNSurface基础信息无法修改和获取?

1、RNSurface基础信息无法修改,SurfaceConfig中的appkey无法修改,酒店业务有场景要修改。

2、RNSurface surfaceHandle中的tag 无法在外层容器中获取到,需要在外层容器中修改代码。

阅读 486
1 个回答

1、appkey是自己定义的,然后app.json里面的name和这个保持一致即可;

2、可以在外层获取相关的tag,参考示例代码:

export function buildCustomRNComponent(ctx: ComponentBuilderContext) {
  // There seems to be a problem with the placement of ArkTS components in mixed mode. Nested Stack temporarily avoided.
  Stack() {
    // if (ctx.componentName === LINEAR_GRADIENT_TYPE) {
    // RNLinearGradient({
    // ctx: ctx.rnComponentContext,
    // tag: ctx.tag,
    // //buildCustomRNComponent: buildCustomRNComponent
    // })
    // }
  }
  .position({ x: 0, y: 0 })
}

在js侧可以通过const rootTag: RootTag = useContext(RootTagContext)拿到RNSurface的tag,但appKey是在编译阶段就确定了,运行时修改不了。