From 5ab8ea566218a1b4642a29697eb5a9b7691674e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E9=98=B3=E6=99=BA?= <1742104739@qq.com> Date: Fri, 22 Dec 2023 16:09:47 +0800 Subject: [PATCH 1/3] =?UTF-8?q?[Issues:=20#I8QMA7]=20=E6=B7=BB=E5=8A=A0rea?= =?UTF-8?q?ct-native-webview=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vmall/react-native-webview.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/vmall/react-native-webview.md b/vmall/react-native-webview.md index 244d9cd8..2a559185 100644 --- a/vmall/react-native-webview.md +++ b/vmall/react-native-webview.md @@ -10,20 +10,20 @@

+>[!tip] [Github 地址](https://github.com/react-native-oh-library/react-native-webview) + ## 安装与使用 进入到工程目录并输入以下命令: -**正在 npm 发布中,当前请先从仓库[Release](https://github.com/react-native-oh-library/react-native-webview/releases)中获取库 tgz,通过使用本地依赖来安装本库。** - ```bash -yarn add xxx +yarn add @react-native-oh-tpl/react-native-webview ``` 或者 ```bash -npm install xxx +npm install @react-native-oh-tpl/react-native-webview ``` 下面的代码展示了这个库的基本使用场景: @@ -53,7 +53,7 @@ import { WebView } from "react-native-webview"; ```json "dependencies": { "rnoh": "file:../rnoh", - "rnoh-webview": "file:../../node_modules/react-native-webview/harmony/rn_webview.har" + "rnoh-webview": "file:../../node_modules/@react-native-oh-tpl/react-native-webview/harmony/rn_webview.har" } ``` @@ -72,7 +72,7 @@ ohpm install ```json "dependencies": { "rnoh": "file:../rnoh", - "rnoh-webview": "file:../../node_modules/react-native-webview/harmony/rn_webview" + "rnoh-webview": "file:../../node_modules/@react-native-oh-tpl/react-native-webview/harmony/rn_webview" } ``` @@ -150,14 +150,14 @@ import { createRNPackages } from '../RNPackagesFactory' @Builder function CustomComponentBuilder(ctx: ComponentBuilderContext) { - if (ctx.descriptor.type === SAMPLE_VIEW_TYPE) { + if (ctx.componentName === SAMPLE_VIEW_TYPE) { SampleView({ ctx: ctx.rnohContext, tag: ctx.descriptor.tag, buildCustomComponent: CustomComponentBuilder }) } -+ else if (ctx.descriptor.type === WEB_VIEW) { ++ else if (ctx.componentName === WEB_VIEW) { + WebView({ + ctx: ctx.rnohContext, + tag: ctx.descriptor.tag, @@ -232,6 +232,7 @@ ohpm install | ` onShouldStartLoadWithRequest?: (event) => void` | Function that allows custom handling of any web view requests. | function | No | iOS,android,macOS | yes | ## 遗留问题 +- [ ] webview部分属性未实现鸿蒙化[issue#17](https://github.com/react-native-oh-library/react-native-webview/issues/17) ## 其他 -- Gitee From aa694659d637fbe85d71474dc650aa20bdfa7aa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E9=98=B3=E6=99=BA?= <1742104739@qq.com> Date: Fri, 22 Dec 2023 16:54:42 +0800 Subject: [PATCH 2/3] =?UTF-8?q?[Issues:=20#I8QMA7]=20=E6=B7=BB=E5=8A=A0rea?= =?UTF-8?q?ct-native-webview=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vmall/react-native-webview.md | 1 + 1 file changed, 1 insertion(+) diff --git a/vmall/react-native-webview.md b/vmall/react-native-webview.md index 2a559185..35bca4e5 100644 --- a/vmall/react-native-webview.md +++ b/vmall/react-native-webview.md @@ -1,3 +1,4 @@ +> 模板版本:v0.1.1

react-native-webview

-- Gitee From 998ad5e7928fa40f04bcaaba2bc2acd78b464e81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=AC=A7=E9=98=B3=E6=99=BA?= <1742104739@qq.com> Date: Fri, 22 Dec 2023 16:59:44 +0800 Subject: [PATCH 3/3] =?UTF-8?q?[Issues:=20#I8QMA7]=20=E6=B7=BB=E5=8A=A0rea?= =?UTF-8?q?ct-native-webview=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vmall/react-native-webview.md | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/vmall/react-native-webview.md b/vmall/react-native-webview.md index 35bca4e5..220b653d 100644 --- a/vmall/react-native-webview.md +++ b/vmall/react-native-webview.md @@ -137,16 +137,6 @@ std::vector> PackageProvider::getPackages(Package::Cont 打开 `entry/src/main/ets/pages/index.ets`,添加: ```diff -import { - RNApp, - ComponentBuilderContext, - RNAbility, - AnyJSBundleProvider, - MetroJSBundleProvider, - ResourceJSBundleProvider, -} from 'rnoh' -import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package" -import { createRNPackages } from '../RNPackagesFactory' + import { WebView, WEB_VIEW } from "rnoh-webview" @Builder @@ -154,14 +144,14 @@ function CustomComponentBuilder(ctx: ComponentBuilderContext) { if (ctx.componentName === SAMPLE_VIEW_TYPE) { SampleView({ ctx: ctx.rnohContext, - tag: ctx.descriptor.tag, + tag: ctx.tag, buildCustomComponent: CustomComponentBuilder }) } + else if (ctx.componentName === WEB_VIEW) { + WebView({ + ctx: ctx.rnohContext, -+ tag: ctx.descriptor.tag, ++ tag: ctx.tag, + buildCustomComponent: CustomComponentBuilder + }) + } -- Gitee