diff --git a/en/react-native-doc-viewer.md b/en/react-native-doc-viewer.md index 2770b9b82da4d4593e0a41609916ff97722f12d4..202b9c266b96ea8fa42a99591752b441ecdf847f 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 5f099db9cfe5f2637301bed2092e375117241692..abda5799f2800d8ff691d5f59accef0538568282 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) - ]; -} -``` ## 运行