From e237d9c02c43b72de396be381a91577589824558 Mon Sep 17 00:00:00 2001 From: zhengjinshou Date: Tue, 3 Feb 2026 15:48:50 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20[Issues:=20#IDO3BU]=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9react-native-doc-viewer=20=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- en/react-native-doc-viewer.md | 22 +++------------------- zh-cn/react-native-doc-viewer.md | 23 +++-------------------- 2 files changed, 6 insertions(+), 39 deletions(-) diff --git a/en/react-native-doc-viewer.md b/en/react-native-doc-viewer.md index 2770b9b8..202b9c26 100644 --- a/en/react-native-doc-viewer.md +++ b/en/react-native-doc-viewer.md @@ -48,12 +48,10 @@ The following code shows the basic use scenario of the repository: > [!WARNING] The name of the imported repository remains unchanged. -> This example relies on the @react-native-ohos/react-native-fs library and is introduced with reference to [@react-native-ohos/react-native-fs](react-native-fs.md). - ```js import React from 'react'; import { ScrollView, StyleSheet, View, Button } from 'react-native'; -import OpenFile from '@react-native-oh-tpl/react-native-doc-viewer'; +import OpenFile from 'react-native-doc-viewer'; interface FileInfo { url?: string; // Local files need to be appended with file:// @@ -358,7 +356,7 @@ Open `entry/src/main/cpp/PackageProvider.cpp` and add the following code: #include "RNOH/PackageProvider.h" #include "generated/RNOHGeneratedPackage.h" #include "SamplePackage.h" -+ #include "DocViewPackage.h" ++ #include "DocViewerPackage.h" using namespace rnoh; @@ -366,24 +364,10 @@ std::vector> PackageProvider::getPackages(Package::Cont return { std::make_shared(ctx), std::make_shared(ctx), -+ std::make_shared(ctx) ++ std::make_shared(ctx) }; } ``` -### 5.Introducing DocViewPackage to ArkTS - -Open the `entry/src/main/ets/RNPackagesFactory.ts` file and add the following code: - -```diff -+ import {DocViewPackage} from '@react-native-ohos/react-native-audio-recorder-player/ts'; - -export function createRNPackages(ctx: RNPackageContext): RNPackage[] { - return [ - new SamplePackage(ctx), -+ new DocViewPackage(ctx) - ]; -} -``` ## Running diff --git a/zh-cn/react-native-doc-viewer.md b/zh-cn/react-native-doc-viewer.md index 5f099db9..abda5799 100644 --- a/zh-cn/react-native-doc-viewer.md +++ b/zh-cn/react-native-doc-viewer.md @@ -48,12 +48,10 @@ yarn add @react-native-ohos/react-native-doc-viewer > [!WARNING] 使用时 import 的库名不变。 -> 本示例依赖@react-native-ohos/react-native-fs 库,参照[@react-native-ohos/react-native-fs](react-native-fs.md)进行引入。 - ```js import React from 'react'; import { ScrollView, StyleSheet, View, Button } from 'react-native'; -import OpenFile from '@react-native-oh-tpl/react-native-doc-viewer'; +import OpenFile from 'react-native-doc-viewer'; interface FileInfo { url?: string; // 本地文件需加 file:// @@ -357,7 +355,7 @@ target_link_libraries(rnoh_app PUBLIC rnoh_sample_package) #include "RNOH/PackageProvider.h" #include "generated/RNOHGeneratedPackage.h" #include "SamplePackage.h" -+ #include "DocViewPackage.h" ++ #include "DocViewerPackage.h" using namespace rnoh; @@ -365,25 +363,10 @@ std::vector> PackageProvider::getPackages(Package::Cont return { std::make_shared(ctx), std::make_shared(ctx), -+ std::make_shared(ctx) ++ std::make_shared(ctx) }; } ``` - -### 5.在 ArkTs 侧引入 DocViewPackage - -打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加: - -```diff -+ import {DocViewPackage} from '@react-native-ohos/react-native-audio-recorder-player/ts'; - -export function createRNPackages(ctx: RNPackageContext): RNPackage[] { - return [ - new SamplePackage(ctx), -+ new DocViewPackage(ctx) - ]; -} -``` ## 运行 -- Gitee