From bb44a98b697660a19056dfd5b6980cdee1956c75 Mon Sep 17 00:00:00 2001 From: sky603629 Date: Tue, 18 Nov 2025 20:46:36 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20react-native-community-hooks=E6=96=87?= =?UTF-8?q?=E6=A1=A3=E5=A2=9E=E5=8A=A0RN=E7=89=88=E6=9C=AC=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E5=92=8C=E4=BF=AE=E6=94=B9description=E4=B8=AD?= =?UTF-8?q?=E6=96=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: sky603629 --- en/react-native-community-hooks.md | 16 ++++--- zh-cn/react-native-community-hooks.md | 60 +++++++++++++++++---------- 2 files changed, 50 insertions(+), 26 deletions(-) diff --git a/en/react-native-community-hooks.md b/en/react-native-community-hooks.md index f6c3f88b..718b0bf5 100644 --- a/en/react-native-community-hooks.md +++ b/en/react-native-community-hooks.md @@ -16,6 +16,11 @@ ## Installation and Usage +| Library Version | Supported RN Version | +| --------------- | -------------------- | +| 1.0.0 | 0.72 | +| 1.0.3 | 0.77 | + Go to the project directory and execute the following instruction: @@ -130,6 +135,7 @@ This document is verified based on the following versions: 1.RNOH: 0.72.27; SDK:HarmonyOS-Next-DB1 5.0.0.25; IDE:DevEco Studio 5.0.3.400SP7; ROM:3.0.0.25; 2.RNOH:0.72.33; SDK:OpenHarmony 5.0.0.71(API Version 12 Release); IDE:DevEco Studio 5.0.3.900; ROM:NEXT.0.0.71; +3.RNOH:0.77.18; SDK:HarmonyOS 6.0.0.47 (API Version 20); IDE:DevEco Studio 6.0.0.858; ROM:6.0.0.107; ## API @@ -150,15 +156,15 @@ This document is verified based on the following versions: | useLayout | Returns the x-axis and y-axis coordinates of an element and the width and height of the element. | Function | False | Android / iOS | Yes | | useRefresh | pull down to refresh. | Function | False | Android / iOS | Yes | -useAccessibilityInfo 方法返回值 +**Return value of `useAccessibilityInfo`** | Name | Description | Platform | HarmonyOS Support | |----------------|-------------------------------| -------- | ----------------- | | isBoldTextEnabled | whether bold text is enabled | iOS | Yes | | isScreenReaderEnabled | Whether the Screen Reading Function Is Enabled | Android / iOS | Yes | -| isGrayscaleEnabled | Whether grayscale mode is enabled | iOS | Yes | -| isInvertColorsEnabled | Whether color inversion is enabled | iOS | Yes | -| isReduceMotionEnabled | Whether reduction animation is enabled | Android / iOS | Yes | -| isReduceTransparencyEnabled | Whether reduce transparency is enabled | iOS | Yes | +| isGrayscaleEnabled | Whether grayscale mode is enabled | iOS | No | +| isInvertColorsEnabled | Whether color inversion is enabled | iOS | No | +| isReduceMotionEnabled | Whether reduction animation is enabled | Android / iOS | No | +| isReduceTransparencyEnabled | Whether reduce transparency is enabled | iOS | No | ## Known Issues diff --git a/zh-cn/react-native-community-hooks.md b/zh-cn/react-native-community-hooks.md index e250b201..27c386f9 100644 --- a/zh-cn/react-native-community-hooks.md +++ b/zh-cn/react-native-community-hooks.md @@ -16,6 +16,11 @@ ## 安装与使用 +| 三方库版本 | 支持RN版本 | +| ---------- | ---------- | +| 3.0.0 | 0.72 | +| 3.1.0 | 0.77 | + 进入到工程目录并输入以下命令: @@ -23,15 +28,25 @@ #### npm ```bash +# V3.0.0 npm install @react-native-community/hooks@3.0.0 + +# V3.1.0 +npm install @react-native-community/hooks@3.1.0 ``` + #### yarn ```bash +# V3.0.0 yarn add @react-native-community/hooks@3.0.0 + +# V3.1.0 +yarn add @react-native-community/hooks@3.1.0 ``` + 下面的代码展示了这个库的基本使用场景: @@ -130,6 +145,7 @@ const styles = StyleSheet.create({ 1.RNOH: 0.72.27; SDK:HarmonyOS-Next-DB1 5.0.0.25; IDE:DevEco Studio 5.0.3.400SP7; ROM:3.0.0.25; 2.RNOH:0.72.33; SDK:OpenHarmony 5.0.0.71(API Version 12 Release); IDE:DevEco Studio 5.0.3.900; ROM:NEXT.0.0.71; +3.RNOH:0.77.18; SDK:HarmonyOS 6.0.0.47 (API Version 20); IDE:DevEco Studio 6.0.0.858; ROM:6.0.0.107; ## API @@ -138,27 +154,29 @@ const styles = StyleSheet.create({ > [!Tip] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。 -| Name | Description | Type | Required | Platform | HarmonyOS Support | -|----------------|-------------------------------| -- | -------- | ----------- | ----------------- | -| useAccessibilityInfo | Check whether some configurations of the device are enabled.See useAccessibilityInfo Api | Function | False | Android / iOS | Yes | -| useAppState | Tells you whether the application is in the foreground or background | Function | False | Android / iOS | Yes | -| useBackHandler | Used to listen for the back button event on the device. You can call your own function to handle the back behavior. | Function | False | Android / iOS | Yes | -| useImageDimensions | Used to listen for the back button event on the device. You can call your own function to handle the back behavior. | Function | False | Android / iOS | Yes | -| useKeyboard | Return whether the keyboard is invoked and the keyboard width and height. | Function | False | Android / iOS | Yes | -| useInteractionManager | Schedule some of the more time-consuming tasks for after all the interactions or animations have been completed. | Function | False | Android / iOS | Yes | -| useDeviceOrientation | Check whether the device is in landscape or portrait mode. | Function | False | Android / iOS | Yes | -| useLayout | Returns the x-axis and y-axis coordinates of an element and the width and height of the element. | Function | False | Android / iOS | Yes | -| useRefresh | pull down to refresh. | Function | False | Android / iOS | Yes | - -useAccessibilityInfo 方法返回值 -| Name | Description | Platform | HarmonyOS Support | -|----------------|-------------------------------| -------- | ----------------- | -| isBoldTextEnabled | whether bold text is enabled | iOS | Yes | -| isScreenReaderEnabled | Whether the Screen Reading Function Is Enabled | Android / iOS | Yes | -| isGrayscaleEnabled | Whether grayscale mode is enabled | iOS | No | -| isInvertColorsEnabled | Whether color inversion is enabled | iOS | No | -| isReduceMotionEnabled | Whether reduction animation is enabled | Android / iOS | No | -| isReduceTransparencyEnabled | Whether reduce transparency is enabled | iOS | No | +| Name | Description | Type | Required | Platform | HarmonyOS Support | +|---|---|---|---|---|---| +| useAccessibilityInfo | 检查设备的某些配置是否已启用。详见 useAccessibilityInfo Api | Function | False | Android / iOS | Yes | +| useAppState | 告知应用当前是在前台还是后台。 | Function | False | Android / iOS | Yes | +| useBackHandler | 用于监听设备上的返回按钮事件。您可以调用自己的函数来处理返回行为。 | Function | False | Android / iOS | Yes | +| useImageDimensions | 用于监听设备上的返回按钮事件。您可以调用自己的函数来处理返回行为。 | Function | False | Android / iOS | Yes | +| useKeyboard | 返回键盘是否弹出及其宽度和高度。 | Function | False | Android / iOS | Yes | +| useInteractionManager | 在所有交互或动画完成后,安排执行一些较为耗时的任务。 | Function | False | Android / iOS | Yes | +| useDeviceOrientation | 检查设备处于横屏还是竖屏模式。 | Function | False | Android / iOS | Yes | +| useLayout | 返回一个元素的 x 轴和 y 轴坐标,以及其宽度和高度。 | Function | False | Android / iOS | Yes | +| useRefresh | 下拉刷新。 | Function | False | Android / iOS | Yes | + + +**useAccessibilityInfo 方法返回值** +| Name | Description | Platform | HarmonyOS Support | +|---|---|---|---| +| isBoldTextEnabled | 粗体文本是否已启用。 | iOS | Yes | +| isScreenReaderEnabled | 屏幕阅读功能是否已启用。 | Android / iOS | Yes | +| isGrayscaleEnabled | 灰度模式是否已启用。 | iOS | No | +| isInvertColorsEnabled | 颜色反转是否已启用。 | iOS | No | +| isReduceMotionEnabled | 减弱动态效果(动画)是否已启用。 | Android / iOS | No | +| isReduceTransparencyEnabled | 降低透明度是否已启用。 | iOS | No | + ## 遗留问题 -- Gitee