From d21c065564659ce6d5be0854536de151fffbc770 Mon Sep 17 00:00:00 2001 From: Louis-C7 Date: Sat, 20 Apr 2024 16:52:47 +0800 Subject: [PATCH] =?UTF-8?q?[Issues:=20#I9HZ41]=20turbomodule=E8=A1=A5?= =?UTF-8?q?=E5=85=85RTNCenteredPackage?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zh-cn/fabric.md | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/zh-cn/fabric.md b/zh-cn/fabric.md index 75b3caf..2b0431c 100644 --- a/zh-cn/fabric.md +++ b/zh-cn/fabric.md @@ -756,7 +756,30 @@ export struct RTNCenteredText { -该部分是 RTNCenteredText 的 HarmonyOS 原生实现。 + + + +#### **RTNCenteredPackage.ts** + +```ts +import { RNPackage } from '@rnoh/react-native-openharmony/ts'; +import type { + DescriptorWrapperFactoryByDescriptorTypeCtx, + DescriptorWrapperFactoryByDescriptorType +} from '@rnoh/react-native-openharmony/ts'; +import { RNC } from "@rnoh/react-native-openharmony/generated/ts" + +export class RTNCenteredTextPackage extends RNPackage { + createDescriptorWrapperFactoryByDescriptorType(ctx: DescriptorWrapperFactoryByDescriptorTypeCtx): DescriptorWrapperFactoryByDescriptorType { + return { + [RNC.RTNCenteredText.NAME]: (ctx) => new RNC.RTNCenteredText.DescriptorWrapper(ctx.descriptor) + } + } +} + +``` + + 创建 `ts.ts` -- Gitee