From 05b4a367c7c91da527dec82c5bcb949642ff60ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E7=90=A6?= Date: Wed, 7 Jan 2026 17:15:25 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20[Issues:=20#IDIAHB]=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9react-native-webview=E6=8C=87=E5=AF=BC=E6=96=87?= =?UTF-8?q?=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 李琦 --- en/react-native-webview.md | 26 ++++++++++----- zh-cn/react-native-webview.md | 60 ++++++++++++++++++++--------------- 2 files changed, 52 insertions(+), 34 deletions(-) diff --git a/en/react-native-webview.md b/en/react-native-webview.md index 7635e40d..fedd13f3 100644 --- a/en/react-native-webview.md +++ b/en/react-native-webview.md @@ -19,10 +19,11 @@ Please refer to the Releases page of the third-party library for the corresponding version information: | Third-party Library Version | Release Information | Supported RN Version | -| ---------- | ------------------------------------------------------------ | ---------- | -| 13.10.4@deprecated | [@react-native-oh-tpl/react-native-webview Releases(deprecated)](https://github.com/react-native-oh-library/react-native-webview/releases) | 0.72 | -| 13.10.5 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.72 | -| 13.15.1 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.77 | +|-----------------------------| ------------------------------------------------------------ |----------------------| +| 13.10.4@deprecated | [@react-native-oh-tpl/react-native-webview Releases(deprecated)](https://github.com/react-native-oh-library/react-native-webview/releases) | 0.72 | +| 13.10.5 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.72 | +| 13.15.1 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.77 | +| 13.16.1 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.82 | For the HarmonyOS version of react-native-webview from 13.10.4-rc.4 onward, compilation requires DevEco Studio 6.0.0 (API20) or higher. @@ -244,10 +245,13 @@ To use this repository, you need to use the correct React-Native and RNOH versio Please refer to the Releases page of the third-party library for the corresponding version information: | Third-party Library Version | Release Information | Supported RN Version | -| ---------- | ------------------------------------------------------------ | ---------- | -| 13.10.4@deprecated | [@react-native-oh-tpl/react-native-webview Releases(deprecated)](https://github.com/react-native-oh-library/react-native-webview/releases) | 0.72 | -| 13.10.5 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.72 | -| 13.15.1 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.77 | +|-----------------------------| ------------------------------------------------------------ |----------------------| +| 13.10.4@deprecated | [@react-native-oh-tpl/react-native-webview Releases(deprecated)](https://github.com/react-native-oh-library/react-native-webview/releases) | 0.72 | +| 13.10.5 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.72 | +| 13.15.1 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.77 | +| 13.16.1 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.82 | + +For the HarmonyOS version of react-native-webview from 13.10.4-rc.4 onward, compilation requires DevEco Studio 6.0.0 (API 20) or higher. ## Properties > [!WARNING] The "ignoreSilentHardwareSwitch" needs to be set to "true" for the web page to have sound when playing. @@ -321,6 +325,10 @@ For details, see [webview official document](https://github.com/react-native-web | `useWebView2?` | Use WinUI WebView2 control instead of WebView control as the native webview. The WebView2 control is a WinUI control that renders web content using the Microsoft Edge (Chromium) rendering engine. Option can be toggled at runtime and supports Fast Refresh. | boolean | NO | Windows | NO | | `applicationNameForUserAgent?` | Append to the existing user-agent. Setting `userAgent` will override this. | string | No | All | yes | | `thirdPartyCookiesEnabled?` | Boolean value to enable third party cookies in the `WebView`. Used on Android Lollipop and above only as third party cookies are enabled by default on Android Kitkat and below and on iOS. The default value is `true`. | boolean | No | All | yes | +| `paymentRequestEnabled13.15.1+` | Whether or not the webview has the Payment Request API enabled.The default value is `false`. | boolean | No | Android | No | +| `allowsPictureInPictureMediaPlayback13.15.1+` | Boolean value that indicates whether HTML5 videos can play Picture in Picture.The default value is `false`. | boolean | No | Android | No | +| `refreshControlLightMode13.15.1+` | (ios only) Boolean value that determines whether the refresh control color is white or not.The default value is `false`. | boolean | No | iOS | No | +| `indicatorStyle 13.15.1+` | The colorstyle of the scroll indicator. | string | No | iOS, Android | No | ## Event callback @@ -344,6 +352,7 @@ For details, see [webview official document](https://github.com/react-native-web | `renderLoading?` | Function that returns a loading indicator. The `startInLoadingState` prop must be set to `true` in order to use this prop. | function | No | iOS, Android, macOS | No | | `onCustomMenuSelection?` | Function called when a custom menu item is selected. It receives a Native event, which includes three custom keys: `label`, `key` and `selectedText`. | function | NO | iOS, Android | No | | `onNavigationStateChange?: (event) => void` | Function that is invoked when the WebView loading starts or ends. | function | NO | iOS, Android | yes | +| `onLoadSubResourceError: (event) => void 13.16.1+` | Function that is sub resource SSL error handling. | function | NO | Android | yes | ## Static Methods @@ -367,6 +376,7 @@ For details, see [webview official document](https://github.com/react-native-web ## Known Issues - [ ] Some attributes of WebView have not been implemented in HarmonyOS[issue#17](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/issues/17) - [ ] Some attributes of WebView have not been implemented in HarmonyOS[issue#200](https://github.com/react-native-oh-library/react-native-webview/issues/200) +- [ ] V13.15.1 The new attribute has not been adapted for HarmonyOS[issue#2](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/issues/2) - [X] Chinese garbled text[issue#18](https://github.com/react-native-oh-library/react-native-webview/issues/18) ## Others diff --git a/zh-cn/react-native-webview.md b/zh-cn/react-native-webview.md index 24ba8296..2195471e 100644 --- a/zh-cn/react-native-webview.md +++ b/zh-cn/react-native-webview.md @@ -18,11 +18,12 @@ 请到三方库的 Releases 发布地址查看配套的版本信息: -| 三方库版本 | 发布信息 | 支持RN版本 | -| ---------- | ------------------------------------------------------------ | ---------- | -| 13.10.4@deprecated | [@react-native-oh-tpl/react-native-webview Releases(deprecated)](https://github.com/react-native-oh-library/react-native-webview/releases) | 0.72 | -| 13.10.5 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.72 | -| 13.15.1 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.77 | +| 三方库版本 | 发布信息 | 支持RN版本 | +|--------------------| ------------------------------------------------------------ |--------| +| 13.10.4@deprecated | [@react-native-oh-tpl/react-native-webview Releases(deprecated)](https://github.com/react-native-oh-library/react-native-webview/releases) | 0.72 | +| 13.10.5 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.72 | +| 13.15.1 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.77 | +| 13.16.1 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.82 | 对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。 @@ -244,11 +245,12 @@ ohpm install 请到三方库的 Releases 发布地址查看配套的版本信息: -| 三方库版本 | 发布信息 | 支持RN版本 | -| ---------- | ------------------------------------------------------------ | ---------- | -| 13.10.4@deprecated | [@react-native-oh-tpl/react-native-webview Releases(deprecated)](https://github.com/react-native-oh-library/react-native-webview/releases) | 0.72 | -| 13.10.5 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.72 | -| 13.15.1 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.77 | +| 三方库版本 | 发布信息 | 支持RN版本 | +|--------------------| ------------------------------------------------------------ |--------| +| 13.10.4@deprecated | [@react-native-oh-tpl/react-native-webview Releases(deprecated)](https://github.com/react-native-oh-library/react-native-webview/releases) | 0.72 | +| 13.10.5 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.72 | +| 13.15.1 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.77 | +| 13.16.1 | [@react-native-ohos/react-native-webview Releases](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/releases) | 0.82 | 鸿蒙化react-native-webview版本在13.10.4-rc.4及之后,编译需要DevEco Studio 6.0.0(API20)及以上版本。 @@ -324,6 +326,10 @@ ohpm install | `useWebView2?` | Use WinUI WebView2 control instead of WebView control as the native webview. The WebView2 control is a WinUI control that renders web content using the Microsoft Edge (Chromium) rendering engine. Option can be toggled at runtime and supports Fast Refresh. | boolean | NO | Windows | NO | | `applicationNameForUserAgent?` | Append to the existing user-agent. Setting `userAgent` will override this. | string | No | All | yes | | `thirdPartyCookiesEnabled?` | Boolean value to enable third party cookies in the `WebView`. Used on Android Lollipop and above only as third party cookies are enabled by default on Android Kitkat and below and on iOS. The default value is `true`. | boolean | No | All | yes | +| `paymentRequestEnabled13.15.1+` | Whether or not the webview has the Payment Request API enabled.The default value is `false`. | boolean | No | Android | No | +| `allowsPictureInPictureMediaPlayback13.15.1+` | Boolean value that indicates whether HTML5 videos can play Picture in Picture.The default value is `false`. | boolean | No | Android | No | +| `refreshControlLightMode13.15.1+` | (ios only) Boolean value that determines whether the refresh control color is white or not.The default value is `false`. | boolean | No | iOS | No | +| `indicatorStyle 13.15.1+` | The colorstyle of the scroll indicator. | string | No | iOS, Android | No | ## 事件回调 @@ -331,22 +337,23 @@ ohpm install > [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。 -| Name | Description | Type | Required | Platform | HarmonyOS Support | -| ------------------------------------------------ | ------------------------------------------------------------ | -------- | -------- | ----------------------- |-------------------| -| `onScroll?: (event) => void` | Function that is invoked when the scroll event is fired in the `WebView`. | function | No | iOS and macOS | yes | -| `onHttpError?: (event) => void` | Function that is invoked when the `WebView` receives an http error. | function | No | yes | yes | -| `onLoadStart?: (event) => void` | Function that is invoked when the `WebView` starts loading. | function | No | All | yes | -| `onLoad?: (event) => void` | Function that is invoked when the `WebView` has finished loading. | function | No | All | yes | -| `onOpenWindow?` | Function that is invoked when the `WebView` should open a new window. | function | No | iOS, Android, macOS | No | -| `injectJavaScript?: (script: string) => void` | Executes the JavaScript string. | function | No | iOS,Android,macOS | yes | -| `onLoadEnd?: (event) => void` | Function that is invoked when the WebView load succeeds or fails used. | function | No | All | yes | -| `onLoadProgress?: (event) => void` | Function that is invoked when the WebView is loading. | function | No | All | yes | -| `onMessage?: (event) => void` | Function that is invoked when the webview calls window.ReactNativeWebView.postMessage. | function | No | iOS,Android,macOS | yes | -| `onShouldStartLoadWithRequest?: (event) => void` | Function that allows custom handling of any web view requests. | function | No | iOS,Android,macOS | yes | -| `onContentProcessDidTerminate: (event) => void` | Function that is invoked when the `WebView` content process is terminated. | function | No | iOS and macOS WKWebView | No | -| `renderLoading?` | Function that returns a loading indicator. The `startInLoadingState` prop must be set to `true` in order to use this prop. | function | No | iOS, Android, macOS | No | -| `onCustomMenuSelection?` | Function called when a custom menu item is selected. It receives a Native event, which includes three custom keys: `label`, `key` and `selectedText`. | function | NO | iOS, Android | No | -| `onNavigationStateChange?: (event) => void` | Function that is invoked when the WebView loading starts or ends. | function | NO | iOS, Android | yes | +| Name | Description | Type | Required | Platform | HarmonyOS Support | +|---------------------------------------------------------------| ------------------------------------------------------------ | -------- | -------- | ----------------------- |-------------------| +| `onScroll?: (event) => void` | Function that is invoked when the scroll event is fired in the `WebView`. | function | No | iOS and macOS | yes | +| `onHttpError?: (event) => void` | Function that is invoked when the `WebView` receives an http error. | function | No | yes | yes | +| `onLoadStart?: (event) => void` | Function that is invoked when the `WebView` starts loading. | function | No | All | yes | +| `onLoad?: (event) => void` | Function that is invoked when the `WebView` has finished loading. | function | No | All | yes | +| `onOpenWindow?` | Function that is invoked when the `WebView` should open a new window. | function | No | iOS, Android, macOS | No | +| `injectJavaScript?: (script: string) => void` | Executes the JavaScript string. | function | No | iOS,Android,macOS | yes | +| `onLoadEnd?: (event) => void` | Function that is invoked when the WebView load succeeds or fails used. | function | No | All | yes | +| `onLoadProgress?: (event) => void` | Function that is invoked when the WebView is loading. | function | No | All | yes | +| `onMessage?: (event) => void` | Function that is invoked when the webview calls window.ReactNativeWebView.postMessage. | function | No | iOS,Android,macOS | yes | +| `onShouldStartLoadWithRequest?: (event) => void` | Function that allows custom handling of any web view requests. | function | No | iOS,Android,macOS | yes | +| `onContentProcessDidTerminate: (event) => void` | Function that is invoked when the `WebView` content process is terminated. | function | No | iOS and macOS WKWebView | No | +| `renderLoading?` | Function that returns a loading indicator. The `startInLoadingState` prop must be set to `true` in order to use this prop. | function | No | iOS, Android, macOS | No | +| `onCustomMenuSelection?` | Function called when a custom menu item is selected. It receives a Native event, which includes three custom keys: `label`, `key` and `selectedText`. | function | NO | iOS, Android | No | +| `onNavigationStateChange?: (event) => void` | Function that is invoked when the WebView loading starts or ends. | function | NO | iOS, Android | yes | +| `onLoadSubResourceError: (event) => void 13.16.1+` | Function that is sub resource SSL error handling. | function | NO | Android | yes | ## 静态方法 > [!TIP] "Platform"列表示该属性在原三方库上支持的平台。 @@ -370,6 +377,7 @@ ohpm install - [ ] webview 部分属性未实现 HarmonyOS 化[issue#17](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/issues/17) - [ ] webview 部分属性未实现 HarmonyOS 化[issue#200](https://github.com/react-native-oh-library/react-native-webview/issues/200) +- [ ] V13.15.1 新增属性未实现 HarmonyOS 化[issue#2](https://gitcode.com/openharmony-sig/rntpc_react-native-webview/issues/2) - [X] 中文乱码[issue#18](https://github.com/react-native-oh-library/react-native-webview/issues/18) ## 其他 -- Gitee