From bc2fd880cd6e04a98b06c74f6977aa9674d010e9 Mon Sep 17 00:00:00 2001
From: quguiren
Date: Fri, 25 Jul 2025 19:32:17 +0800
Subject: [PATCH] =?UTF-8?q?docs:=20[Issues:=20#ICOWXT]=20=E6=B7=BB?=
=?UTF-8?q?=E5=8A=A00.77=E4=B8=89=E6=96=B9=E5=BA=93=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/lottie-react-native.md | 113 ++-
zh-cn/react-native-community-blur.md | 890 +++++++++---------
.../react-native-community-datetimepicker.md | 656 +++++++------
zh-cn/react-native-gesture-handler.md | 48 +-
zh-cn/react-native-pager-view.md | 535 ++++++-----
zh-cn/react-native-picker-picker.md | 54 +-
zh-cn/react-native-reanimated.md | 589 ++++++------
zh-cn/react-native-safe-area-context.md | 565 +++++------
zh-cn/react-native-spring-scrollview.md | 45 +-
zh-cn/react-native-webview.md | 123 ++-
zh-cn/shopify-flash-list.md | 44 +-
11 files changed, 2072 insertions(+), 1590 deletions(-)
diff --git a/zh-cn/lottie-react-native.md b/zh-cn/lottie-react-native.md
index 766a4add..ccd498e2 100644
--- a/zh-cn/lottie-react-native.md
+++ b/zh-cn/lottie-react-native.md
@@ -16,7 +16,14 @@
## 安装与使用
-请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/lottie-react-native Releases](https://github.com/react-native-oh-library/lottie-react-native/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。
+请到三方库的 Releases 发布地址查看配套的版本信息:
+
+| 三方库版本 | 发布信息 | 支持RN版本 |
+| ---------- | ------------------------------------------------------------ | ---------- |
+| 6.4.1 | [@react-native-oh-tpl/lottie-react-native Releases](https://github.com/react-native-oh-library/lottie-react-native/releases) | 0.72 |
+| 7.2.2 | [@react-native-ohos/lottie-react-native Releases]() | 0.77 |
+
+对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。
进入到工程目录并输入以下命令:
@@ -25,13 +32,21 @@
#### **npm**
```bash
+# V6.4.1
npm install @react-native-oh-tpl/lottie-react-native
+
+# V7.2.2
+npm install @react-native-ohos/lottie-react-native
```
#### **yarn**
```bash
+# V6.4.1
yarn add @react-native-oh-tpl/lottie-react-native
+
+# V7.2.2
+yarn add @react-native-ohos/lottie-react-native
```
@@ -92,6 +107,8 @@ export default App;
打开 `entry/oh-package.json5`,添加以下依赖
+- V6.4.1
+
```json
"dependencies": {
"@rnoh/react-native-openharmony": "file:../react_native_openharmony",
@@ -99,6 +116,15 @@ export default App;
}
```
+- V7.2.2
+
+```json
+"dependencies": {
+ "@rnoh/react-native-openharmony": "file:../react_native_openharmony",
+ "@react-native-ohos/lottie-react-native": "file:../../node_modules/@react-native-ohos/lottie-react-native/harmony/lottie.har"
+ }
+```
+
点击右上角的 `sync` 按钮
或者在终端执行:
@@ -134,7 +160,13 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn)
# RNOH_BEGIN: manual_package_linking_1
add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
+
+# V6.4.1
+ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/lottie-react-native/src/main/cpp" ./lottie)
+
+# V7.2.2
++ add_subdirectory("${OH_MODULES}/@react-native-ohos/lottie-react-native/src/main/cpp" ./lottie)
+
# RNOH_END: manual_package_linking_1
file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
@@ -174,8 +206,13 @@ std::vector> PackageProvider::getPackages(Package::Cont
```diff
...
+
+# V6.4.1
+ import {LottieAnimationViewPackage} from '@react-native-oh-tpl/lottie-react-native/ts';
+# V7.2.2
++ import {LottieAnimationViewPackage} from '@react-native-ohos/lottie-react-native/ts';
+
export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
return [
+ new LottieAnimationViewPackage(ctx)
@@ -189,8 +226,12 @@ export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
```diff
...
+# V6.4.1
+ import { LottieAnimationView, LOTTIE_TYPE } from "@react-native-oh-tpl/lottie-react-native"
+# V7.2.2
++ import { LottieAnimationView, LOTTIE_TYPE } from "@react-native-ohos/lottie-react-native"
+
@Builder
export function buildCustomRNComponent(ctx: ComponentBuilderContext) {
...
@@ -237,7 +278,12 @@ ohpm install
要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/lottie-react-native Releases](https://github.com/react-native-oh-library/lottie-react-native/releases)
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:
+
+| 三方库版本 | 发布信息 | 支持RN版本 |
+| ---------- | ------------------------------------------------------------ | ---------- |
+| 6.4.1 | [@react-native-oh-tpl/lottie-react-native Releases](https://github.com/react-native-oh-library/lottie-react-native/releases) | 0.72 |
+| 7.2.2 | [@react-native-ohos/lottie-react-native Releases]() | 0.77 |
### 权限要求
@@ -263,30 +309,32 @@ rawfile 路径:`entry/src/main/resources/rawfile`
> [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
-| Name | Description | Type | Default | Required | Platform | HarmonyOS Support |
-| ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------- | --------- | -------- | --------------------- |-------------------|
-| source | Mandatory - The source of animation. Can be referenced as a local asset by a string, or remotely with an object with a uri property, or it can be an actual JS object of an animation, obtained (for example) with something like require('../path/to/animation.json') | string\| AnimationObject \| { uri: string } | None | Yes | All | Yes |
-| progress | A number between 0 and 1. This number represents the normalized progress of the animation. If you update this prop, the animation will correspondingly update to the frame at that progress value. This prop is not required if you are using the imperative API. | number | 0 | No | iOS, Android, Windows | Yes |
-| speed | The speed the animation will progress. Sending a negative value will reverse the animation | number | 1 | No | All | Yes |
-| duration | The duration of the animation in ms. Takes precedence over speed when set. This only works when source is an actual JS object of an animation. | number | undefined | No | iOS, Android, Windows | Yes |
-| loop | A boolean flag indicating whether or not the animation should loop. | boolean | true | No | All | Yes |
-| autoPlay | A boolean flag indicating whether or not the animation should start automatically when mounted. This only affects the imperative API. | boolean | false | No | All | Yes |
-| resizeMode | Determines how to resize the animated view when the frame doesn't match the raw image dimensions. Supports cover, contain and center. | 'cover'\| 'contain' \| 'center' | contain | No | iOS, Android, Windows | Yes |
-| style | Style attributes for the view, as expected in a standard View, aside from border styling | StyleProp | None | No | iOS, Android, Windows | Yes |
-| webStyle | Style attributes for the view, it uses CSSProperties. | CSSProperties | None | No | Web | No |
-| imageAssetsFolder | Needed for Android and HarmonyOS to work properly with assets, iOS will ignore it. | string | None | No | Android | Yes |
-| useNativeLooping | Only Windows. When enabled, uses platform-level looping to improve smoothness, but onAnimationLoop will not fire and changing the loop prop will reset playback rather than finishing gracefully. | boolean | false | No | Windows | No |
-| onAnimationLoop | Only Windows and Web. A callback function invoked when the animation loops. | callback | None | No | Windows, Web | No |
-| onAnimationFinish | A callback function which will be called when animation is finished. This callback is called with a boolean isCancelled argument, indicating if the animation actually completed playing, or if it was cancelled, for instance by calling play() or reset() while is was still playing. Note that this callback will be called only when loop is set to false. | callback | None | No | All | Yes |
-| onAnimationFailure | A callback function which will be called if an error occurs while working with the animation (loading, running, etc). This callback is called with a string error argument, which contains the error message that occured. | callback | None | No | All | Yes |
-| onAnimationLoaded | A callback function which will be called when animation is done loading. This callback is called with no parameters. | callback | None | No | All | Yes |
-| renderMode | a String flag to set whether or not to render with HARDWARE or SOFTWARE acceleration | 'AUTOMATIC'\| 'HARDWARE' \| 'SOFTWARE' | AUTOMATIC | No | iOS, Android | No |
-| cacheComposition | Only Android and HarmonyOS, a boolean flag indicating whether or not the animation should do caching. | boolean | true | No | Android | Yes |
-| colorFilters | An array of objects denoting layers by KeyPath and a new color filter value (as hex string). | Array | [] | No | iOS, Android, Windows | Yes |
-| textFiltersAndroid | Only Android, an array of objects denoting text values to find and replace. | Array | [] | No | Android | No |
-| textFiltersIOS | Only iOS, an array of objects denoting text layers by KeyPath and a new string value. | Array | [] | No | iOS | No |
-| hover | Only Web, a boolean denoting whether to play on mouse hover. | boolean | false | No | Web | No |
-| direction | Only Web a number from 1 or -1 denoting playing direction. | 1\| -1 | 1 | No | Web | No |
+| Name | Description | Type | Default | Required | Platform | HarmonyOS Support |
+| -------------------------------------- | ------------------------------------------------------------ | ------------------------------------------- | --------- | -------- | --------------------- | ----------------- |
+| source | Mandatory - The source of animation. Can be referenced as a local asset by a string, or remotely with an object with a uri property, or it can be an actual JS object of an animation, obtained (for example) with something like require('../path/to/animation.json') | string\| AnimationObject \| { uri: string } | None | Yes | All | Yes |
+| progress | A number between 0 and 1. This number represents the normalized progress of the animation. If you update this prop, the animation will correspondingly update to the frame at that progress value. This prop is not required if you are using the imperative API. | number | 0 | No | iOS, Android, Windows | Yes |
+| speed | The speed the animation will progress. Sending a negative value will reverse the animation | number | 1 | No | All | Yes |
+| duration | The duration of the animation in ms. Takes precedence over speed when set. This only works when source is an actual JS object of an animation. | number | undefined | No | iOS, Android, Windows | Yes |
+| loop | A boolean flag indicating whether or not the animation should loop. | boolean | true | No | All | Yes |
+| autoPlay | A boolean flag indicating whether or not the animation should start automatically when mounted. This only affects the imperative API. | boolean | false | No | All | Yes |
+| resizeMode | Determines how to resize the animated view when the frame doesn't match the raw image dimensions. Supports cover, contain and center. | 'cover'\| 'contain' \| 'center' | contain | No | iOS, Android, Windows | Yes |
+| style | Style attributes for the view, as expected in a standard View, aside from border styling | StyleProp | None | No | iOS, Android, Windows | Yes |
+| webStyle | Style attributes for the view, it uses CSSProperties. | CSSProperties | None | No | Web | No |
+| imageAssetsFolder | Needed for Android and HarmonyOS to work properly with assets, iOS will ignore it. | string | None | No | Android | Yes |
+| useNativeLooping | Only Windows. When enabled, uses platform-level looping to improve smoothness, but onAnimationLoop will not fire and changing the loop prop will reset playback rather than finishing gracefully. | boolean | false | No | Windows | No |
+| onAnimationLoop | Only Windows and Web. A callback function invoked when the animation loops. | callback | None | No | Windows, Web | No |
+| onAnimationFinish | A callback function which will be called when animation is finished. This callback is called with a boolean isCancelled argument, indicating if the animation actually completed playing, or if it was cancelled, for instance by calling play() or reset() while is was still playing. Note that this callback will be called only when loop is set to false. | callback | None | No | All | Yes |
+| onAnimationFailure | A callback function which will be called if an error occurs while working with the animation (loading, running, etc). This callback is called with a string error argument, which contains the error message that occured. | callback | None | No | All | Yes |
+| onAnimationLoaded | A callback function which will be called when animation is done loading. This callback is called with no parameters. | callback | None | No | All | Yes |
+| renderMode | a String flag to set whether or not to render with HARDWARE or SOFTWARE acceleration | 'AUTOMATIC'\| 'HARDWARE' \| 'SOFTWARE' | AUTOMATIC | No | iOS, Android | No |
+| enableSafeModeAndroid | A boolean flag to enable safe mode which wraps the draw call with a try catch on Android. | boolean | false | No | Android | NO |
+| cacheComposition | Only Android and HarmonyOS, a boolean flag indicating whether or not the animation should do caching. | boolean | true | No | Android | Yes |
+| colorFilters | An array of objects denoting layers by KeyPath and a new color filter value (as hex string). | Array | [] | No | iOS, Android, Windows | Yes |
+| textFiltersAndroid | Only Android, an array of objects denoting text values to find and replace. | Array | [] | No | Android | No |
+| textFiltersIOS | Only iOS, an array of objects denoting text layers by KeyPath and a new string value. | Array | [] | No | iOS | No |
+| hover | Only Web, a boolean denoting whether to play on mouse hover. | boolean | false | No | Web | No |
+| direction | Only Web a number from 1 or -1 denoting playing direction. | 1\| -1 | 1 | No | Web | No |
+| enableSafeModeAndroid7.2.2+ | A boolean flag to enable safe mode which wraps the draw call with a try catch on Android | props | None | No | All | No |
## 静态方法 (Imperative API)
@@ -294,12 +342,12 @@ rawfile 路径:`entry/src/main/resources/rawfile`
> [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
-| Name | Description | Type | Required | Platform | HarmonyOS Support |
-| ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- | -------- | -------- | ----------------- |
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+| ------ | ------------------------------------------------------------ | -------- | -------- | -------- | ----------------- |
| play | Play the animation all the way through, at the speed specified as a prop. It can also play a section of the animation (not available on web) when called as play(startFrame, endFrame). | function | No | All | Yes |
-| reset | Reset the animation back to 0 progress. | function | No | All | Yes |
-| pause | Pauses the animation. | function | No | All | Yes |
-| resume | Resumes the paused animation. | function | No | All | Yes |
+| reset | Reset the animation back to 0 progress. | function | No | All | Yes |
+| pause | Pauses the animation. | function | No | All | Yes |
+| resume | Resumes the paused animation. | function | No | All | Yes |
## 遗留问题
@@ -309,5 +357,4 @@ rawfile 路径:`entry/src/main/resources/rawfile`
## 开源协议
-本项目基于 [Apache License 2.0](https://github.com/lottie-react-native/lottie-react-native/blob/master/LICENSE) ,请自由地享受和参与开源。
-
+本项目基于 [Apache License 2.0](https://github.com/lottie-react-native/lottie-react-native/blob/master/LICENSE) ,请自由地享受和参与开源。
\ No newline at end of file
diff --git a/zh-cn/react-native-community-blur.md b/zh-cn/react-native-community-blur.md
index 04ffb79c..467b225a 100644
--- a/zh-cn/react-native-community-blur.md
+++ b/zh-cn/react-native-community-blur.md
@@ -1,424 +1,466 @@
-> 模板版本:v0.2.2
-
-
-
-> [!TIP] [Github 地址](https://github.com/react-native-oh-library/datetimepicker)
-
-## 安装与使用
-
-请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/datetimepicker Releases](https://github.com/react-native-oh-library/datetimepicker/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。
-
-进入到工程目录并输入以下命令:
-
-
-
-#### **npm**
-
-```bash
-npm install @react-native-oh-tpl/datetimepicker
-```
-
-#### **yarn**
-
-```bash
-yarn add @react-native-oh-tpl/datetimepicker
-```
-
-
-
-下面的代码展示了这个库的基本使用场景:
-
-> [!WARNING] 使用时 import 的库名不变。
-
-```js
-import React, { useState } from 'react'
-import DateTimePicker from '@react-native-community/datetimepicker';
-import { SafeAreaView, Button, Text } from 'react-native'
-
-export const MDatetimepicker = () => {
- const [date, setDate] = useState(new Date(new Date()));
- const [mode, setMode] = useState('date');
- const [show, setShow] = useState(false);
-
- const onChange = (event: any, selectedDate: any) => {
- const currentDate = selectedDate;
- setShow(false);
- setDate(currentDate);
- };
-
- const showMode = (currentMode: React.SetStateAction) => {
- setShow(true);
- setMode(currentMode);
- };
-
- const showDatepicker = () => {
- showMode('date');
- };
-
- const showTimepicker = () => {
- showMode('time');
- };
-
- return (
-
-
-
- selected: {date.toLocaleString()}
- {show && (
-
- )}
-
- );
-};
-```
-
-## Link
-
-目前 HarmonyOS 暂不支持 AutoLink,所以 Link 步骤需要手动配置。
-
-首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`
-
-### 1.在工程根目录的 `oh-package.json5` 添加 overrides 字段
-
-
-
-```json
-{
- ...
- "overrides": {
- "@rnoh/react-native-openharmony" : "./react_native_openharmony"
- }
-}
-```
-
-### 2.引入原生端代码
-
-目前有两种方法:
-
-1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
-2. 直接链接源码。
-
-方法一:通过 har 包引入
-
-> [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。
-
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "@rnoh/react-native-openharmony": "file:../react_native_openharmony",
-
- "@react-native-oh-tpl/datetimepicker": "file:../../node_modules/@react-native-oh-tpl/datetimepicker/harmony/datetimepicker.har"
-}
-```
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-方法二:直接链接源码
-
-> [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md)
-
-### 3.配置 CMakeLists 和引入 datetimepicker
-
-打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
-
-```diff
-project(rnapp)
-cmake_minimum_required(VERSION 3.4.1)
-set(CMAKE_SKIP_BUILD_RPATH TRUE)
-set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
-+ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
-set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
-set(LOG_VERBOSITY_LEVEL 1)
-set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments")
-set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie")
-set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use
-add_compile_definitions(WITH_HITRACE_SYSTRACE)
-
-add_subdirectory("${RNOH_CPP_DIR}" ./rn)
-
-# RNOH_BEGIN: manual_package_linking_1
-add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
-+ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/datetimepicker/src/main/cpp" ./datetimepicker)
-# RNOH_END: manual_package_linking_1
-
-file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
-
-add_library(rnoh_app SHARED
- ${GENERATED_CPP_FILES}
- "./PackageProvider.cpp"
- "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
-)
-target_link_libraries(rnoh_app PUBLIC rnoh)
-
-# RNOH_BEGIN: manual_package_linking_2
-target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
-+ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
-# RNOH_END: manual_package_linking_2
-```
-
-打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
-
-```diff
-#include "RNOH/PackageProvider.h"
-#include "generated/RNOHGeneratedPackage.h"
-#include "SamplePackage.h"
-+ #include "DateTimePickerPackage.h"
-
-using namespace rnoh;
-
-std::vector> PackageProvider::getPackages(Package::Context ctx) {
- return {
- std::make_shared(ctx),
- std::make_shared(ctx),
-+ std::make_shared(ctx),
- };
-}
-```
-
-### 4.在 ArkTs 侧引入 DateTimePicker 组件
-
-找到 **function buildCustomComponent()**,一般位于 `entry/src/main/ets/pages/index.ets` 或 `entry/src/main/ets/rn/LoadBundle.ets`,添加:
-
-```diff
- ...
-+ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "@react-native-oh-tpl/datetimepicker"
-
-@Builder
-export function buildCustomRNComponent(ctx: ComponentBuilderContext) {
- ...
-+ if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
-+ RNDateTimePicker({
-+ ctx: ctx.rnComponentContext,
-+ tag: ctx.tag,
-+ })
-+ }
- ...
-}
-...
-```
-
-> [!TIP] 本库使用了混合方案,需要添加组件名。(如使用混合方案)
-
-在`entry/src/main/ets/pages/index.ets` 或 `entry/src/main/ets/rn/LoadBundle.ets` 找到常量 `arkTsComponentNames` 在其数组里添加组件名
-
-```diff
-const arkTsComponentNames: Array = [
- SampleView.NAME,
- GeneratedSampleView.NAME,
- PropsDisplayer.NAME,
-+ DATETIME_PICKER_VIEW_TYPE
-];
-```
-### 5.运行
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-然后编译、运行即可。
-
-## 约束与限制
-
-### 兼容性
-
-要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-
-请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/datetimepicker Releases](https://github.com/react-native-oh-library/datetimepicker/releases)
-
-## 属性
-
-> [!TIP] "Platform"列表示该属性在原三方库上支持的平台。
-
-> [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
-
-详情请查看[datetimepicker 官方文档](https://github.com/react-native-datetimepicker/datetimepicker)
-
-| Name | Description | Type | Required | Platform | HarmonyOS Support |
-| ----------- | -------------------------------------------------------- | -------- | -------- | ------------------------ | ------------------------------------------------- |
-| mode | Defines the type of the picker | string | 否 | All | partially (仅支持 date/time 模式) |
-| style | Sets style directly on picker component. | object | 否 | IOS only | yes |
-| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | partially (支持"default", "spinner","compact","inline") |
-| onChange | Date change handler. | function | 否 | All | partially (仅支持 type 为 set 类型) |
-| value | Defines the date or time value used in the component. | Date | 是 | All | partially (仅 mode=date 且 display=spinner 时支持动态设置) |
-| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
-| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | partially (仅支持在 mode=date 且 display=spinner 时设置) |
-| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | partially (仅支持在 mode=date 且 display=spinner 时设置) |
-| disabled | If true, the user won't be able to interact with the view. | bool | 否 | IOS only | yes |
-| textColor | Allows changing of the textColor of the date picker. | string | 否 | IOS only | partially (仅支持在 mode=date 且 display=compact 时设置) |
-| timeZoneName | Allows changing of the time zone of the date picker. By default, it uses the device's time zone. Use the time zone name from the IANA (TZDB) database name in https://en.wikipedia.org/wiki/List_of_tz_database_time_zones. | string | 否 | iOS and Android only | No |
-| timeZoneOffsetInMinutes | Allows changing of the time zone of the date picker. By default, it uses the device's time zone. We strongly recommend using timeZoneName prop instead; this prop has known issues in the android implementation (eg. #528). | number | 否 | iOS and Android only | No |
-| timeZoneOffsetInSeconds | Allows changing of the time zone of the date picker. By default, it uses the device's time zone. | number | 否 | Windows only | No |
-| dayOfWeekFormat | Sets the display format for the day of the week headers. Reference: https://docs.microsoft.com/en-us/uwp/api/windows. ui.xaml.controls.calendarview.dayofweekformat?view=winrt-18362#remarks | string | 否 | Windows only | No |
-| dateFormat | Sets the display format for the date value in the picker's text box. Reference: https://docs.microsoft.com/en-us/uwp/api/windows.globalization.datetimeformatting.datetimeformatter?view=winrt-18362#examples | string | 否 | Windows only | No |
-| firstDayOfWeek | Indicates which day is shown as the first day of the week. | number | 否 | Android and Windows only | No |
-| accentColor | Allows changing the accentColor (tintColor) of the date picker. Has no effect when display is "spinner". | string | 否 | iOS only | No |
-| themeVariant | Allows overriding system theme variant (dark or light mode) used by the date picker. However, we recommend that you instead control the theme of the whole application using react-native-theme-control. | string | 否 | iOS only | No |
-| locale | Allows changing the locale of the component. This affects the displayed text and the date / time formatting. By default, the device's locale is used. Please note using this prop is discouraged due to not working reliably in all picker modes. Prefer localization as documented in Localization note. | string | 否 | iOS only | No |
-| positiveButton | Set the positive button label and text color. | Object | 否 | Android only | No |
-| neutralButton | Allows displaying neutral button on picker dialog. Pressing button can be observed in onChange handler as event.type === 'neutralButtonPressed' | Object | 否 | Android only | No |
-| negativeButton | Set the negative button label and text color. | Object | 否 | Android only | No |
-| minuteInterval | The interval at which minutes can be selected. Possible values are: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30On Windows, this can be any number between 0-59. | number | 否 | All | No |
-| testID | Usually used by app automation frameworks. Fully supported on iOS. On Android, only supported for mode="date". | string | 否 | All | Yes |
-| ViewProps | On iOS, you can pass any View props to the component. Given that the underlying component is a native view, not all of them are guaranteed to be supported, but testID and onLayout are known to work. | Object | 否 | iOS only | No |
-| onError | Callback that is called when an error occurs inside the date picker native code (such as null activity). | function | 否 | Android only | No |
-
-
-## 遗留问题
-
-- [x] 已解决:textColor 属性在 compact 和 inline 模式改变值后使用禁用操作,颜色会变白色[issue#17](https://github.com/react-native-oh-library/datetimepicker/issues/17)
-- [ ] 部分接口,未适配: [issue#20](https://github.com/react-native-oh-library/datetimepicker/issues/20#issue-2390348970)
-
-## 其他
-
-## 开源协议
-
-本项目基于 [The MIT License (MIT)](https://github.com/react-native-datetimepicker/datetimepicker/blob/master/LICENSE.md) ,请自由地享受和参与开源。
+> 模板版本:v0.2.2
+
+
+
+> [!TIP] [Github 地址](https://gitcode.com/openharmony-sig/rntpc_react-native-safe-area-context)
+
+## 安装与使用
+
+请到三方库的 Releases 发布地址查看配套的版本信息:
+
+| 三方库版本 | 发布信息 | 支持RN版本 |
+| ---------- | ------------------------------------------------------------ | ---------- |
+| 4.7.4 | [@react-native-oh-tpl/react-native-safe-area-context Releases](https://github.com/react-native-oh-library/react-native-safe-area-context/releases) | 0.72 |
+| 5.1.0 | [@react-native-ohos/react-native-safe-area-context Releases]() | 0.77 |
+
+对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。
+
+进入到工程目录并输入以下命令:
+
+
+
+#### **npm**
+
+```bash
+# V4.7.4
+npm install @react-native-oh-tpl/react-native-safe-area-context
+
+# V5.1.0
+npm install @react-native-ohos/react-native-safe-area-context
+```
+
+#### **yarn**
+
+```bash
+# V4.7.4
+yarn add @react-native-oh-tpl/react-native-safe-area-context
+
+# V5.1.0
+yarn add @react-native-ohos/react-native-safe-area-context
+```
+
+
+
+下面的代码展示了这个库的基本使用场景:
+
+> [!WARNING] 使用时 import 的库名不变。
+
+```js
+import React from "react";
+import { Text, View } from "react-native";
+import {
+ SafeAreaProvider,
+ SafeAreaView,
+ initialWindowMetrics,
+} from "react-native-safe-area-context";
+
+const App = () => {
+ return (
+
+
+
+ hello
+
+
+
+ );
+};
+
+export default App;
+```
+
+## Link
+
+目前 HarmonyOS 暂不支持 AutoLink,所以 Link 步骤需要手动配置。
+
+首先需要使用 DevEco Studio 打开项目里的 HarmonyOS 工程 `harmony`
+
+### 1.在工程根目录的 `oh-package.json5` 添加 overrides 字段
+
+```json
+{
+ ...
+ "overrides": {
+ "@rnoh/react-native-openharmony" : "./react_native_openharmony"
+ }
+}
+```
+
+### 2.引入原生端代码
+
+目前有两种方法:
+
+1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
+2. 直接链接源码。
+
+方法一:通过 har 包引入
+
+> [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。
+
+打开 `entry/oh-package.json5`,添加以下依赖
+
+- V4.7.4
+
+```json
+"dependencies": {
+ "@rnoh/react-native-openharmony": "file:../react_native_openharmony",
+
+ "@react-native-oh-tpl/react-native-safe-area-context": "file:../../node_modules/@react-native-oh-tpl/react-native-safe-area-context/harmony/safe_area.har"
+ }
+```
+
+- V5.1.0
+
+```json
+"dependencies": {
+ "@rnoh/react-native-openharmony": "file:../react_native_openharmony",
+
+ "@react-native-ohos/react-native-safe-area-context": "file:../../node_modules/@react-native-ohos/react-native-safe-area-context/harmony/safe_area.har"
+ }
+```
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+方法二:直接链接源码
+
+> [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md)
+
+### 3.配置 CMakeLists 和引入 SafeAreaViewPackage
+
+打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
+
+```diff
+```diff
+project(rnapp)
+cmake_minimum_required(VERSION 3.4.1)
+set(CMAKE_SKIP_BUILD_RPATH TRUE)
+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
++ set(OH_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
+set(LOG_VERBOSITY_LEVEL 1)
+set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments")
+set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie")
+set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use
+add_compile_definitions(WITH_HITRACE_SYSTRACE)
+
+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
+
+# RNOH_BEGIN: manual_package_linking_1
+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
+
+# V4.7.4
++ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/react-native-safe-area-context/src/main/cpp" ./safe-area)
+
+# V5.1.0
++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-safe-area-context/src/main/cpp" ./safe-area)
+
+# RNOH_END: manual_package_linking_1
+
+file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
+
+add_library(rnoh_app SHARED
+ ${GENERATED_CPP_FILES}
+ "./PackageProvider.cpp"
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
+)
+target_link_libraries(rnoh_app PUBLIC rnoh)
+
+# RNOH_BEGIN: manual_package_linking_2
+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
++ target_link_libraries(rnoh_app PUBLIC rnoh_safe_area)
+# RNOH_END: manual_package_linking_2
+```
+
+打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
+
+```diff
+#include "RNOH/PackageProvider.h"
+#include "generated/RNOHGeneratedPackage.h"
+#include "SamplePackage.h"
++ #include "SafeAreaViewPackage.h"
+
+using namespace rnoh;
+
+std::vector> PackageProvider::getPackages(Package::Context ctx) {
+ return {
+ std::make_shared(ctx),
+ std::make_shared(ctx),
++ std::make_shared(ctx),
+ };
+}
+```
+
+### 4.在 ArkTs 侧引入 SafeAreaViewPackage
+
+打开 `entry/src/main/ets/RNPackagesFactory.ts`,添加:
+
+```diff
+...
+// V4.7.4
++ import {SafeAreaViewPackage} from '@react-native-oh-tpl/react-native-safe-area-context/ts';
+
+// V5.1.0
++ import {SafeAreaViewPackage} from '@react-native-ohos/react-native-safe-area-context/ts';
+
+export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
+ return [
+ new SamplePackage(ctx),
++ new SafeAreaViewPackage(ctx)
+ ];
+}
+```
+
+### 5.运行
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+然后编译、运行即可。
+
+## 兼容性
+
+要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
+
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:
+
+| 三方库版本 | 发布信息 | 支持RN版本 |
+| ---------- | ------------------------------------------------------------ | ---------- |
+| 4.7.4 | [@react-native-oh-tpl/react-native-safe-area-context Releases](https://github.com/react-native-oh-library/react-native-safe-area-context/releases) | 0.72 |
+| 5.1.0 | [@react-native-ohos/react-native-safe-area-context Releases]() | 0.77 |
+
+## 属性
+
+> [!TIP] "Platform"列表示该属性在原三方库上支持的平台。
+
+> [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
+
+**组件 SafeAreaProvider**
+
+You should add `SafeAreaProvider` in your app root component. You may need to add it in other places like the root of modals and routes when using react-native-screens.
+
+Note that providers should not be inside a View that is animated with Animated or inside a ScrollView since it can cause very frequent updates.
+
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+| ---------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------ | -------- | -------- | -------- |
+| `Props` | Accepts all View props. Has a default style of {flex: 1}. | object | no | All | yes |
+| `initialMetrics` | Can be used to provide the initial value for frame and insets, this allows rendering immediatly. See optimization for more information on how to use this prop. | object | no | All | yes |
+
+**组件 SafeAreaView**
+
+`SafeAreaView` is a regular View component with the safe area insets applied as padding or margin.
+
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+| ------- | ----------------------------------------------------------------------------------------------- | ------ | -------- | -------- | -------- |
+| `Props` | Accepts all View props. Has a default style of {flex: 1}. | object | no | All | yes |
+| `edges` | Sets the edges to apply the safe area insets to. Defaults to all. | array | no | All | yes |
+| `mode` | Optional, padding (default) or margin. Apply the safe area to either the padding or the margin. | string | no | All | yes |
+
+# API
+
+> [!TIP] "Platform"列表示该属性在原三方库上支持的平台。
+
+> [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
+
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+| ---- | ----------- |----------|----------| -------- | ------------------ |
+| useSafeAreaInsets | Returns the safe area insets of the nearest provider. | object | no | All | yes |
+| useSafeAreaFrame | Returns the frame of the nearest provider. This can be used as an alternative to the Dimensions module. | object | no | All | yes |
+| SafeAreaInsetsContext | React Context with the value of the safe area insets. | object | no | All | yes |
+| withSafeAreaInsets | Higher order component that provides safe area insets as the insets prop. | function | no | All | yes |
+| SafeAreaFrameContext | React Context with the value of the safe area frame. | object | no | All | yes |
+| initialWindowMetrics | Insets and frame of the window on initial render. This can be used with the initialMetrics from SafeAreaProvider | object | no | All | yes |
+
+## 遗留问题
+
+## 其他
+
+## 开源协议
+
+本项目基于 [The MIT License (MIT)](https://github.com/th3rdwave/react-native-safe-area-context/blob/main/LICENSE) ,请自由地享受和参与开源。
diff --git a/zh-cn/react-native-spring-scrollview.md b/zh-cn/react-native-spring-scrollview.md
index 2c35a749..f23ffad7 100644
--- a/zh-cn/react-native-spring-scrollview.md
+++ b/zh-cn/react-native-spring-scrollview.md
@@ -16,7 +16,14 @@
## 安装与使用
-请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-spring-scrollview Releases](https://github.com/react-native-oh-library/react-native-spring-scrollview/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。
+请到三方库的 Releases 发布地址查看配套的版本信息:
+
+| 三方库版本 | 发布信息 | 支持RN版本 |
+| ---------- | ------------------------------------------------------------ | ---------- |
+| 3.0.2 | [@react-native-oh-tpl/react-native-spring-scrollview Releases](https://github.com/react-native-oh-library/react-native-spring-scrollview/releases) | 0.72 |
+| 3.0.2 | [@react-native-ohos/react-native-spring-scrollview Releases]() | 0.77 |
+
+对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。
进入到工程目录并输入以下命令:
@@ -25,13 +32,21 @@
#### **npm**
```bash
+# V3.0.2 for RN0.72
npm install @react-native-oh-tpl/react-native-spring-scrollview
+
+# V3.0.2 for RN0.77
+npm install @react-native-ohos/react-native-spring-scrollview
```
#### **yarn**
```bash
+# V3.0.2 for RN0.72
yarn add @react-native-oh-tpl/react-native-spring-scrollview
+
+# V3.0.2 for RN0.77
+yarn add @react-native-ohos/react-native-spring-scrollview
```
@@ -203,6 +218,8 @@ const styles = StyleSheet.create({
打开 `entry/oh-package.json5`,添加以下依赖
+- V3.0.2 for RN0.72
+
```json
"dependencies": {
"@rnoh/react-native-openharmony": "file:../react_native_openharmony",
@@ -210,6 +227,15 @@ const styles = StyleSheet.create({
}
```
+- V3.0.2 for RN0.77
+
+```json
+"dependencies": {
+ "@rnoh/react-native-openharmony": "file:../react_native_openharmony",
+ "@react-native-ohos/react-native-spring-scrollview": "file:../../node_modules/@react-native-ohos/react-native-spring-scrollview/harmony/spring_scrollview.har",
+ }
+```
+
点击右上角的 `sync` 按钮
或者在终端执行:
@@ -245,7 +271,13 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn)
# RNOH_BEGIN: manual_package_linking_1
add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
+
+# V3.0.2 for RN0.72
+ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/react-native-spring-scrollview/src/main/cpp" ./spring_scrollview)
+
+# V3.0.2 for RN0.77
++ add_subdirectory("${OH_MODULES}/@react-native-ohos/react-native-spring-scrollview/src/main/cpp" ./spring_scrollview)
+
# RNOH_END: manual_package_linking_1
file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
@@ -288,8 +320,12 @@ std::vector> PackageProvider::getPackages(Package::Cont
```diff
...
+// V3.0.2 for RN0.72
+ import {SpringScrollViewPackage} from '@react-native-oh-tpl/react-native-spring-scrollview/ts';
+// V3.0.2 for RN0.77
++ import {SpringScrollViewPackage} from '@react-native-ohos/react-native-spring-scrollview/ts';
+
export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
return [
new SamplePackage(ctx),
@@ -317,7 +353,12 @@ ohpm install
要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-spring-scrollview Releases](https://github.com/react-native-oh-library/react-native-spring-scrollview/releases)
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:
+
+| 三方库版本 | 发布信息 | 支持RN版本 |
+| ---------- | ------------------------------------------------------------ | ---------- |
+| 3.0.2 | [@react-native-oh-tpl/react-native-spring-scrollview Releases](https://github.com/react-native-oh-library/react-native-spring-scrollview/releases) | 0.72 |
+| 3.0.2 | [@react-native-ohos/react-native-spring-scrollview Releases]() | 0.77 |
## 属性
diff --git a/zh-cn/react-native-webview.md b/zh-cn/react-native-webview.md
index 852d6fea..e98bee66 100644
--- a/zh-cn/react-native-webview.md
+++ b/zh-cn/react-native-webview.md
@@ -16,23 +16,37 @@
## 安装与使用
-请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-webview Releases](https://github.com/react-native-oh-library/react-native-webview/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。
+请到三方库的 Releases 发布地址查看配套的版本信息:
-进入到工程目录并输入以下命令:
+| 三方库版本 | 发布信息 | 支持RN版本 |
+| ---------- | ------------------------------------------------------------ | ---------- |
+| 13.10.2 | [@react-native-oh-tpl/react-native-webview Releases](https://github.com/react-native-oh-library/react-native-webview/releases) | 0.72 |
+| 13.15.0 | [@react-native-ohos/react-native-webview Releases]() | 0.77 |
+
+对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。
+进入到工程目录并输入以下命令:
#### **npm**
```bash
+# V13.10.2
npm install @react-native-oh-tpl/react-native-webview
+
+# V13.15.0
+npm install @react-native-ohos/react-native-webview
```
#### **yarn**
```bash
+# V13.10.2
yarn add @react-native-oh-tpl/react-native-webview
+
+# V13.15.0
+yarn add @react-native-ohos/react-native-webview
```
@@ -81,6 +95,8 @@ export default function WebViewDemo() {
打开 `entry/oh-package.json5`,添加以下依赖
+- V13.10.2
+
```json
"dependencies": {
"@rnoh/react-native-openharmony": "file:../react_native_openharmony",
@@ -89,6 +105,16 @@ export default function WebViewDemo() {
}
```
+- V13.15.0
+
+```json
+"dependencies": {
+ "@rnoh/react-native-openharmony": "file:../react_native_openharmony",
+
+ "@react-native-ohos/react-native-webview": "file:../../node_modules/@react-native-ohos/react-native-webview/harmony/rn_webview.har"
+}
+```
+
点击右上角的 `sync` 按钮
或者在终端执行:
@@ -125,8 +151,13 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn)
# RNOH_BEGIN: manual_package_linking_1
add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
+
+# V13.10.2
+ add_subdirectory("${OH_MODULE_DIR}/@react-native-oh-tpl/react-native-webview/src/main/cpp" ./webview)
+# V13.15.0
++ add_subdirectory("${OH_MODULE_DIR}/@react-native-ohos/react-native-webview/src/main/cpp" ./webview)
+
# RNOH_END: manual_package_linking_1
file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
@@ -166,8 +197,12 @@ std::vector> PackageProvider::getPackages(Package::Cont
找到 **function buildCustomComponent()**,一般位于 `entry/src/main/ets/pages/index.ets` 或 `entry/src/main/ets/rn/LoadBundle.ets`,添加:
```diff
+// V13.10.2
+ import { WebView, WEB_VIEW } from "@react-native-oh-tpl/react-native-webview"
+// V13.15.0
++ import { WebView, WEB_VIEW } from "@react-native-ohos/react-native-webview"
+
@Builder
function buildCustomComponent(ctx: ComponentBuilderContext) {
+ if (ctx.componentName === WEB_VIEW) {
@@ -201,8 +236,13 @@ const arkTsComponentNames: Array = [
```diff
import type {RNPackageContext, RNPackage} from 'rnoh/ts';
import {SamplePackage} from 'rnoh-sample-package/ts';
+
+// V13.10.2
+ import { WebViewPackage } from '@react-native-oh-tpl/react-native-webview/ts';
+// V13.15.0
++ import { WebViewPackage } from '@react-native-ohos/react-native-webview/ts';
+
export function createRNPackages(ctx: RNPackageContext): RNPackage[] {
return [
new SamplePackage(ctx),
@@ -230,7 +270,12 @@ ohpm install
要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[ @react-native-oh-tpl/react-native-webview Releases](https://github.com/react-native-oh-library/react-native-webview/releases)
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:
+
+| 三方库版本 | 发布信息 | 支持RN版本 |
+| ---------- | ------------------------------------------------------------ | ---------- |
+| 13.10.2 | [ @react-native-oh-tpl/react-native-webview Releases](https://github.com/react-native-oh-library/react-native-webview/releases) | 0.72 |
+| 13.15.0 | [ @react-native-ohos/react-native-webview Releases]() | 0.77 |
## 属性
> [!WARNING]ignoreSilentHardwareSwitch需要设置true网页播放才有声音
@@ -257,12 +302,12 @@ ohpm install
| `cacheEnabled?` | Sets whether WebView should use browser caching. | boolean | No | iOS,Android,macOS | yes |
| `cacheMode?` | Overrides the way the cache is used. | string | No | Android | yes |
| `textZoom?` | If the user has set a custom font size in the Android and harmony system, an undesirable scale of the site interface in WebView occurs. | number | No | Android | yes |
-| `incognito?` | Does not store any data within the lifetime of the WebView. | boolean | NO | All | yes |
-| `mediaPlaybackRequiresUserAction?` | Boolean that determines whether HTML5 audio and video requires the user to tap them before they start playing. The default value is `true`. (Android API minimum version 17). | boolean | NO | iOS,Android,macOS | yes |
-| `geolocationEnabled?` | Set whether Geolocation is enabled in the `WebView`. The default value is `false`. Used only in Android. | boolean | NO | Android | yes |
-| `fraudulentWebsiteWarningEnabled?` | A Boolean value that indicates whether the web view shows warnings for suspected fraudulent content, such as malware or phishing attempts. The default value is `true`. (iOS 13+) | boolean | NO | iOS | 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`. For more on cookies, | boolean | NO | Android | yes |
-| `userAgent?` | Sets the user-agent for the `WebView`. | string | NO | iOS,Android,macOS | yes |
+| `incognito?` | Does not store any data within the lifetime of the WebView. | boolean | No | All | yes |
+| `mediaPlaybackRequiresUserAction?` | Boolean that determines whether HTML5 audio and video requires the user to tap them before they start playing. The default value is `true`. (Android API minimum version 17). | boolean | No | iOS,Android,macOS | yes |
+| `geolocationEnabled?` | Set whether Geolocation is enabled in the `WebView`. The default value is `false`. Used only in Android. | boolean | No | Android | yes |
+| `fraudulentWebsiteWarningEnabled?` | A Boolean value that indicates whether the web view shows warnings for suspected fraudulent content, such as malware or phishing attempts. The default value is `true`. (iOS 13+) | boolean | No | iOS | 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`. For more on cookies, | boolean | No | Android | yes |
+| `userAgent?` | Sets the user-agent for the `WebView`. | string | No | iOS,Android,macOS | yes |
| `minimumFontSize?` | Android enforces a minimum font size based on this value. A non-negative integer between 1 and 72. Any number outside the specified range will be pinned. Default value is 8. If you are using smaller font sizes and are having trouble fitting the whole window onto one screen, try setting this to a smaller value. | number | No | Android | yes |
| `forceDarkOn?` | Configuring Dark Theme | boolean | No | Android | yes |
| `injectedJavaScriptBeforeContentLoaded?` | Set this to provide JavaScript that will be injected into the web page after the document element is created, but before other subresources finish loading. | string | No | iOS,Android,macOS | yes |
@@ -274,36 +319,40 @@ ohpm install
| `javaScriptCanOpenWindowsAutomatically?` | A Boolean value indicating whether JavaScript can open windows without user interaction. The default value is `false`. | boolean | No | iOS, Android, macOS | No |
| `AndroidLayerType?` | Specifies the layer type. | string | No | Android | No |
| `mixedContentMode?` |Specifies the mixed content mode. i.e WebView will allow a secure origin to load content from any other origin. | string | No | Android | No |
-| `allowsFullscreenVideo?` | Boolean that determines whether videos are allowed to be played in fullscreen. The default value is false. | boolean | NO | Android | NO |
-| `allowsInlineMediaPlayback?` | Boolean that determines whether HTML5 videos play inline or use the native full-screen controller. The default value is `false`. | boolean | NO | iOS | NO |
-| `allowsAirPlayForMediaPlayback?` | A Boolean value indicating whether AirPlay is allowed. The default value is `false`. | boolean | NO | iOS and macOS | NO |
-| `contentInset?` | The amount by which the web view content is inset from the edges of the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}. | object | NO | iOS | NO |
-| `contentInsetAdjustmentBehavior?` | This property specifies how the safe area insets are used to modify the content area of the scroll view. The default value of this property is "never". Available on iOS 11 and later. Defaults to `never`. | string | NO | iOS | NO |
-| `contentMode?` | Controls the type of content to load. Available on iOS 13 and later. Defaults to `recommended`, which loads mobile content on iPhone & iPad Mini but desktop content on larger iPads. | string | No | iOS |NO|
-| `dataDetectorTypes?` | Determines the types of data converted to clickable URLs in the web view's content. By default only phone numbers are detected. | string, or array | NO | ios | NO |
-| `setBuiltInZoomControls?` | Sets whether the WebView should use its built-in zoom mechanisms. The default value is `true`. Setting this to `false` will prevent the use of a pinch gesture to control zooming. | boolean | NO | Android | NO |
-| `setDisplayZoomControls?` | Sets whether the WebView should display on-screen zoom controls when using the built-in zoom mechanisms (see `setBuiltInZoomControls`). The default value is `false`. | boolean | NO | Android | NO |
-| `directionalLockEnabled?` | A Boolean value that determines whether scrolling is disabled in a particular direction. The default value is `true`. | boolean | NO | iOS | NO |
-| `allowFileAccessFromFileURLs?` | Boolean that sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from other file scheme URLs. The default value is `false`. | boolean | NO | iOS, Android, macOS | NO |
+| `allowsFullscreenVideo?` | Boolean that determines whether videos are allowed to be played in fullscreen. The default value is false. | boolean | No | Android | No |
+| `allowsInlineMediaPlayback?` | Boolean that determines whether HTML5 videos play inline or use the native full-screen controller. The default value is `false`. | boolean | No | iOS | No |
+| `allowsAirPlayForMediaPlayback?` | A Boolean value indicating whether AirPlay is allowed. The default value is `false`. | boolean | No | iOS and macOS | No |
+| `contentInset?` | The amount by which the web view content is inset from the edges of the scroll view. Defaults to {top: 0, left: 0, bottom: 0, right: 0}. | object | No | iOS | No |
+| `contentInsetAdjustmentBehavior?` | This property specifies how the safe area insets are used to modify the content area of the scroll view. The default value of this property is "never". Available on iOS 11 and later. Defaults to `never`. | string | No | iOS | No |
+| `contentMode?` | Controls the type of content to load. Available on iOS 13 and later. Defaults to `recommended`, which loads mobile content on iPhone & iPad Mini but desktop content on larger iPads. | string | No | iOS |No|
+| `dataDetectorTypes?` | Determines the types of data converted to clickable URLs in the web view's content. By default only phone numbers are detected. | string, or array | No | ios | No |
+| `setBuiltInZoomControls?` | Sets whether the WebView should use its built-in zoom mechanisms. The default value is `true`. Setting this to `false` will prevent the use of a pinch gesture to control zooming. | boolean | No | Android | No |
+| `setDisplayZoomControls?` | Sets whether the WebView should display on-screen zoom controls when using the built-in zoom mechanisms (see `setBuiltInZoomControls`). The default value is `false`. | boolean | No | Android | No |
+| `directionalLockEnabled?` | A Boolean value that determines whether scrolling is disabled in a particular direction. The default value is `true`. | boolean | No | iOS | No |
+| `allowFileAccessFromFileURLs?` | Boolean that sets whether JavaScript running in the context of a file scheme URL should be allowed to access content from other file scheme URLs. The default value is `false`. | boolean | No | iOS, Android, macOS | No |
| `allowUniversalAccessFromFileURLs?` | boolean | NO | No | iOS, Android, macOS |No|
-| `allowingReadAccessToURL` | A String value that indicates which URLs the WebView's file can then reference in scripts, AJAX requests, and CSS imports. This is only used in for WebViews that are loaded with a `source.uri` set to a `'file://'` URL. If not provided, the default is to only allow read access to the URL provided in `source.uri` itself. | string | NO | iOS and macOS | NO |
-| `keyboardDisplayRequiresUserAction?` | If `false`, web content can programmatically display the keyboard. The default value is `true`. | boolean | NO | iOS and macOS | NO |
-| `hideKeyboardAccessoryView?` | If `true`, this will hide the keyboard accessory view (< > and Done). | boolean | NO | iOS | NO |
-| `allowsBackForwardNavigationGestures?` | If `true`, this will be able horizontal swipe gestures. The default value is `false`. | boolean | NO | iOS |No|
-| `allowFileAccess?` | If `true`, this will allow access to the file system via `file://` URI's. The default value is `false`. | boolean | NO | Android | NO |
-| `saveFormDataDisabled?` | Sets whether the WebView should disable saving form data. The default value is `false`. This function does not have any effect from Android API level 26 onwards as there is an Autofill feature which stores form data. | boolean | NO | Android | NO |
-| `pagingEnabled?` | If the value of this property is `true`, the scroll view stops on multiples of the scroll view’s bounds when the user scrolls. The default value is `false`. | boolean | NO | iOS | NO |
-| `allowsLinkPreview?` | A Boolean value that determines whether pressing on a link displays a preview of the destination for the link. In iOS this property is available on devices that support 3D Touch. In iOS 10 and later, the default value is `true`; before that, the default value is `false` | boolean | NO | iOS and macOS | NO |
-| `sharedCookiesEnabled?` | Set `true` if shared cookies from `[NSHTTPCookieStorage sharedHTTPCookieStorage]` should be used for every load request in the WebView. The default value is `false`. For more on cookies, read the [Guide](https://github.com/react-native-webview/react-native-webview/blob/master/docs/Guide.md#Managing-Cookies) | boolean | NO | iOS and macOS | NO |
-| `limitsNavigationsToAppBoundDomains?` | If `true` indicates to WebKit that a WKWebView will only navigate to app-bound domains. Only applicable for iOS 14 or greater. | boolean | NO | iOS |No|
-| `textInteractionEnabled?` | If false indicates to WebKit that a WKWebView will not interact with text, thus not showing a text selection loop. Only applicable for iOS 14.5 or greater. | boolean | NO | iOS | NO |
-| `suppressMenuItems?` | Allows to suppress menu item from the default context menu. | array of strings | NO | iOS | NO |
-| `mediaCapturePermissionGrantType?` | This property specifies how to handle media capture permission requests. Defaults to `prompt`, resulting in the user being prompted repeatedly. Available on iOS 15 and later. | string | NO | iOS |No|
-| `autoManageStatusBarEnabled?` | If set to `true`, the status bar will be automatically hidden/shown by WebView, specifically when full screen video is being watched. If `false`, WebView will not manage the status bar at all. The default value is `true`. | boolean | NO | iOS | NO |
-| `basicAuthCredential`? | object that specifies the credentials of a user to be used for basic authentication. | object | NO | iOS, Android | NO |
-| `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 |
+| `allowingReadAccessToURL` | A String value that indicates which URLs the WebView's file can then reference in scripts, AJAX requests, and CSS imports. This is only used in for WebViews that are loaded with a `source.uri` set to a `'file://'` URL. If not provided, the default is to only allow read access to the URL provided in `source.uri` itself. | string | No | iOS and macOS | No |
+| `keyboardDisplayRequiresUserAction?` | If `false`, web content can programmatically display the keyboard. The default value is `true`. | boolean | No | iOS and macOS | No |
+| `hideKeyboardAccessoryView?` | If `true`, this will hide the keyboard accessory view (< > and Done). | boolean | No | iOS | No |
+| `allowsBackForwardNavigationGestures?` | If `true`, this will be able horizontal swipe gestures. The default value is `false`. | boolean | No | iOS |No|
+| `allowFileAccess?` | If `true`, this will allow access to the file system via `file://` URI's. The default value is `false`. | boolean | No | Android | No |
+| `saveFormDataDisabled?` | Sets whether the WebView should disable saving form data. The default value is `false`. This function does not have any effect from Android API level 26 onwards as there is an Autofill feature which stores form data. | boolean | No | Android | No |
+| `pagingEnabled?` | If the value of this property is `true`, the scroll view stops on multiples of the scroll view’s bounds when the user scrolls. The default value is `false`. | boolean | No | iOS | No |
+| `allowsLinkPreview?` | A Boolean value that determines whether pressing on a link displays a preview of the destination for the link. In iOS this property is available on devices that support 3D Touch. In iOS 10 and later, the default value is `true`; before that, the default value is `false` | boolean | No | iOS and macOS | No |
+| `sharedCookiesEnabled?` | Set `true` if shared cookies from `[NSHTTPCookieStorage sharedHTTPCookieStorage]` should be used for every load request in the WebView. The default value is `false`. For more on cookies, read the [Guide](https://github.com/react-native-webview/react-native-webview/blob/master/docs/Guide.md#Managing-Cookies) | boolean | No | iOS and macOS | No |
+| `limitsNavigationsToAppBoundDomains?` | If `true` indicates to WebKit that a WKWebView will only navigate to app-bound domains. Only applicable for iOS 14 or greater. | boolean | No | iOS |No|
+| `textInteractionEnabled?` | If false indicates to WebKit that a WKWebView will not interact with text, thus not showing a text selection loop. Only applicable for iOS 14.5 or greater. | boolean | No | iOS | No |
+| `suppressMenuItems?` | Allows to suppress menu item from the default context menu. | array of strings | No | iOS | No |
+| `mediaCapturePermissionGrantType?` | This property specifies how to handle media capture permission requests. Defaults to `prompt`, resulting in the user being prompted repeatedly. Available on iOS 15 and later. | string | No | iOS |No|
+| `autoManageStatusBarEnabled?` | If set to `true`, the status bar will be automatically hidden/shown by WebView, specifically when full screen video is being watched. If `false`, WebView will not manage the status bar at all. The default value is `true`. | boolean | No | iOS | No |
+| `basicAuthCredential`? | object that specifies the credentials of a user to be used for basic authentication. | object | No | iOS, Android | No |
+| `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.0+ | Whether or not the webview has the Payment Request API enabled.The default value is `false`. | boolean | No | Android | No |
+| allowsPictureInPictureMediaPlayback13.15.0+ | Boolean value that indicates whether HTML5 videos can play Picture in Picture.The default value is `false`. | boolean | No | Android | No |
+| refreshControlLightMode13.15.0+ | (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.0+ | The colorstyle of the scroll indicator. | string | No | iOS, Android | No |
## 事件回调
@@ -347,7 +396,7 @@ ohpm install
## 遗留问题
-- [ ] webview 部分属性未实现 HarmonyOS 化[issue#200](https://github.com/react-native-oh-library/react-native-webview/issues/200)
+- [ ] webview 部分属性未实现 HarmonyOS 化[issue#200](https://github.com/react-native-oh-library/react-native-webview/issues/200)、[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)
## 其他
diff --git a/zh-cn/shopify-flash-list.md b/zh-cn/shopify-flash-list.md
index 3afc142d..146aed82 100644
--- a/zh-cn/shopify-flash-list.md
+++ b/zh-cn/shopify-flash-list.md
@@ -16,20 +16,35 @@
## 安装与使用
-请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/flash-list Releases](https://github.com/react-native-oh-library/flash-list/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。
+请到三方库的 Releases 发布地址查看配套的版本信息:
+
+| 三方库版本 | 发布信息 | 支持RN版本 |
+| ---------- | ------------------------------------------------------------ | ---------- |
+| 1.6.3 | [@react-native-oh-tpl/flash-list Releases](https://github.com/react-native-oh-library/flash-list/releases) | 0.72 |
+| 1.8.2 | [@react-native-ohos/flash-list Releases]() | 0.77 |
+
+对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。
进入到工程目录并输入以下命令:
#### **npm**
```bash
+# V1.6.3
npm install @react-native-oh-tpl/flash-list
+
+# V1.8.2
+npm install @react-native-ohos/flash-list
```
#### **yarn**
```bash
+# V1.6.3
yarn add @react-native-oh-tpl/flash-list
+
+# V1.8.2
+yarn add @react-native-ohos/flash-list
```
下面的代码展示了这个库的基本使用场景:
@@ -73,7 +88,7 @@ const MyList = () => {
{
...
"overrides": {
- "@rnoh/react-native-openharmony" : "./react_native_openharmony"
+ "@rnoh/react-native-openharmony": "file:./../node_modules/react-native-harmony/harmony/react_native_openharmony.har"
}
}
```
@@ -91,6 +106,8 @@ const MyList = () => {
打开 `entry/oh-package.json5`,添加以下依赖
+- V1.6.3
+
```json
"dependencies": {
"@rnoh/react-native-openharmony": "file:../react_native_openharmony",
@@ -98,6 +115,15 @@ const MyList = () => {
}
```
+- V1.8.2
+
+```json
+"dependencies": {
+ "@rnoh/react-native-openharmony": "file:../../node_modules/react-native-harmony/harmony/react_native_openharmony.har",
+ "@react-native-ohos/flash-list": "file:../../node_modules/@react-native-ohos/flash-list/harmony/flash_list.har"
+ }
+```
+
点击右上角的 `sync` 按钮
或者在终端执行:
@@ -133,7 +159,13 @@ add_subdirectory("${RNOH_CPP_DIR}" ./rn)
# RNOH_BEGIN: manual_package_linking_1
add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
+
+# V1.6.3
+ add_subdirectory("${OH_MODULES}/@react-native-oh-tpl/flash-list/src/main/cpp" ./flash-list)
+
+# V1.8.2
++ add_subdirectory("${OH_MODULES}/@react-native-ohos/flash-list/src/main/cpp" ./flash-list)
+
# RNOH_END: manual_package_linking_1
file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
@@ -189,7 +221,12 @@ ohpm install
要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/flash-list Releases](https://github.com/react-native-oh-library/flash-list/releases)
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:
+
+| 三方库版本 | 发布信息 | 支持RN版本 |
+| ---------- | ------------------------------------------------------------ | ---------- |
+| 1.6.3 | [@react-native-oh-tpl/flash-list Releases](https://github.com/react-native-oh-library/flash-list/releases) | 0.72 |
+| 1.8.2 | [@react-native-ohos/flash-list Releases]() | 0.77 |
## 属性
@@ -251,6 +288,7 @@ ohpm install
| scrollToIndex | Scroll to a given index. | function | No | All | Yes |
| scrollToItem | Scroll to a given item. | function | No | All | Yes |
| scrollToOffset | Scroll to a specific content pixel offset in the list. | function | No | All | Yes |
+| recomputeViewableItems1.8.2 | Retriggers viewability calculations. Useful to imperatively trigger viewability calculations. | function | No | All | Yes |
## 遗留问题
--
Gitee