From 87e4bf8c8dfc5a8bc182b2726f196eccd753a72c Mon Sep 17 00:00:00 2001 From: sky603629 Date: Mon, 24 Nov 2025 20:38:34 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20react-native-ratings=E4=BF=AE=E6=94=B9d?= =?UTF-8?q?escription=E4=B8=AD=E6=96=87=E5=92=8C=E8=A1=A5=E5=85=85?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: sky603629 --- en/react-native-ratings.md | 9 ++++- zh-cn/react-native-ratings.md | 71 +++++++++++++++++++---------------- 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/en/react-native-ratings.md b/en/react-native-ratings.md index 7bc5f7d5..606c85bb 100644 --- a/en/react-native-ratings.md +++ b/en/react-native-ratings.md @@ -17,6 +17,10 @@ ## Installation and Usage +| Library Version | Supported RN Version | +| :--- | :--- | +| 8.1.0 | 0.72/0.77 | + #### **npm** @@ -126,6 +130,7 @@ This document is verified based on the following versions: 1. RNOH:0.72.20; SDK:HarmonyOS NEXT Developer Beta1; IDE:DevEco Studio 5.0.3.200; ROM:3.0.0.18; 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; ## Properties @@ -137,7 +142,7 @@ This document is verified based on the following versions: | Name | Description | Type | Required | Platform | HarmonyOS Support | | :-----------------------: | :-----------------------------------------------: | :------------------------------------------------------: | :------: | :---------: | :---------------: | | **type** | Choose one of the built-in types: star, rocket, bell, heart or use type custom to render a custom image (optional) | String | No | iOS/Android | Yes | -| **ratingImage** | Pass in a custom image source; use this along with type='custom' prop above (optional) | String | YES | iOS/Android | Yes | +| **ratingImage** | Pass in a custom image source; use this along with type='custom' prop above (optional) | String | No | iOS/Android | Yes | | **ratingColor** | Pass in a custom fill-color for the rating icon; use this along with type='custom' prop above (optional) | String | No | iOS/Android | Yes | | **ratingBackgroundColor** | Pass in a custom background-fill-color for the rating icon; use this along with type='custom' prop above (optional) | String | No | iOS/Android | Yes | | **tintColor** | Color used to change the background of the rating icon (optional) | String | No | iOS/Android | Yes | @@ -153,7 +158,7 @@ This document is verified based on the following versions: | **jumpValue** | The value to jump when rating value changes (if jumpValue === 0.5, rating value increases/decreases like 0, 0.5, 1.0, 1.5 ...). Default is 0 (not to jump) | number | No | iOS/Android | Yes | | **onStartRating** | Callback method when the user starts rating. Gives you the start rating value as a whole number | function | No | iOS/Android | Yes | | **onSwipeRating** | Callback method when the user is swiping. Gives you the current rating value as a whole number | function | No | iOS/Android | Yes | -| **onFinishRating** | Callback method when the user finishes rating. Gives you the final rating value as a whole number (required) | function | No | iOS/Android | Yes | +| **onFinishRating** | Callback method when the user finishes rating. Gives you the final rating value as a whole number (required) | function | Yes | iOS/Android | Yes | ## **API(AirbnbRating)** > [!TIP] The **Platform** column indicates the platform where the properties are supported in the original third-party library. diff --git a/zh-cn/react-native-ratings.md b/zh-cn/react-native-ratings.md index 01001d7d..5fb175fb 100644 --- a/zh-cn/react-native-ratings.md +++ b/zh-cn/react-native-ratings.md @@ -17,6 +17,10 @@ ## 安装与使用 +| 三方库版本 | 支持RN版本 | +| :--- | :--- | +| 8.1.0 | 0.72/0.77 | + #### **npm** @@ -126,6 +130,7 @@ export function RatingsDemo () { 1. RNOH:0.72.20; SDK:HarmonyOS NEXT Developer Beta1; IDE:DevEco Studio 5.0.3.200; ROM:3.0.0.18; 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; ## 属性 @@ -136,24 +141,24 @@ export function RatingsDemo () { | Name | Description | Type | Required | Platform | HarmonyOS Support | | :-----------------------: | :-----------------------------------------------: | :------------------------------------------------------: | :------: | :---------: | :---------------: | -| **type** | Choose one of the built-in types: star, rocket, bell, heart or use type custom to render a custom image (optional) | String | No | iOS/Android | Yes | -| **ratingImage** | Pass in a custom image source; use this along with type='custom' prop above (optional) | String | YES | iOS/Android | Yes | -| **ratingColor** | Pass in a custom fill-color for the rating icon; use this along with type='custom' prop above (optional) | String | No | iOS/Android | Yes | -| **ratingBackgroundColor** | Pass in a custom background-fill-color for the rating icon; use this along with type='custom' prop above (optional) | String | No | iOS/Android | Yes | -| **tintColor** | Color used to change the background of the rating icon (optional) | String | No | iOS/Android | Yes | -| **ratingCount** | The number of rating images to display (optional) | number | No | iOS/Android | Yes | -| **ratingTextColor** | Color used for the text labels | String | No | iOS/Android | Yes | -| **imageSize** | The size of each rating image (optional) | number | No | iOS/Android | Yes | -| **showRating** | Displays the Built-in Rating UI to show the rating value in real-time (optional) | boolean | No | iOS/Android | Yes | -| **readonly** | Whether the rating can be modiefied by the user | boolean | No | iOS/Android | Yes | -| **startingValue** | The initial rating to render | number | No | iOS/Android | Yes | -| **fractions** | The number of decimal places for the rating value; must be between 0 and 20 | number | No | iOS/Android | Yes | -| **minValue** | The minimum value the user can select | number | No | iOS/Android | Yes | -| **style** | Exposes style prop to add additonal styling to the container view (optional) | style | No | iOS/Android | Yes | -| **jumpValue** | The value to jump when rating value changes (if jumpValue === 0.5, rating value increases/decreases like 0, 0.5, 1.0, 1.5 ...). Default is 0 (not to jump) | number | No | iOS/Android | Yes | -| **onStartRating** | Callback method when the user starts rating. Gives you the start rating value as a whole number | function | No | iOS/Android | Yes | -| **onSwipeRating** | Callback method when the user is swiping. Gives you the current rating value as a whole number | function | No | iOS/Android | Yes | -| **onFinishRating** | Callback method when the user finishes rating. Gives you the final rating value as a whole number (required) | function | No | iOS/Android | Yes | +| **type** | 选择内置类型之一:star、rocket、bell、heart,或者使用 type='custom' 来渲染自定义图片(可选)。 | String | No | iOS/Android | Yes | +| **ratingImage** | 传入自定义图片资源;需配合上述 type='custom' 属性使用(可选)。 | String | No | iOS/Android | Yes | +| **ratingColor** | 传入评分图标的自定义填充颜色;需配合上述 type='custom' 属性使用(可选)。 | String | No | iOS/Android | Yes | +| **ratingBackgroundColor** | 传入评分图标的自定义背景填充颜色;需配合上述 type='custom' 属性使用(可选)。 | String | No | iOS/Android | Yes | +| **tintColor** | 用于改变评分图标背景的颜色(可选)。 | String | No | iOS/Android | Yes | +| **ratingCount** | 显示的评分图片数量(可选)。 | number | No | iOS/Android | Yes | +| **ratingTextColor** | 文本标签的颜色。 | String | No | iOS/Android | Yes | +| **imageSize** | 每个评分图片的大小(可选)。 | number | No | iOS/Android | Yes | +| **showRating** | 显示内置的评分 UI 以实时展示评分值(可选)。 | boolean | No | iOS/Android | Yes | +| **readonly** | 用户是否可以修改评分。 | boolean | No | iOS/Android | Yes | +| **startingValue** | 渲染时的初始评分。 | number | No | iOS/Android | Yes | +| **fractions** | 评分值的小数位数;必须在 0 到 20 之间。 | number | No | iOS/Android | Yes | +| **minValue** | 用户可以选择的最小值。 | number | No | iOS/Android | Yes | +| **style** | 暴露样式属性以向容器视图添加额外样式(可选)。 | style | No | iOS/Android | Yes | +| **jumpValue** | 评分值变化时的跳跃值(如果 jumpValue === 0.5,评分值将按 0, 0.5, 1.0, 1.5... 增减)。默认为 0(不跳跃)。 | number | No | iOS/Android | Yes | +| **onStartRating** | 用户开始评分时的回调方法。提供整数形式的开始评分值。 | function | No | iOS/Android | Yes | +| **onSwipeRating** | 用户滑动时的回调方法。提供整数形式的当前评分值。 | function | No | iOS/Android | Yes | +| **onFinishRating** | 用户完成评分时的回调方法。提供整数形式的最终评分值(必填)。 | function | Yes | iOS/Android | Yes | ## **API(AirbnbRating)** > [!TIP] "Platform"列表示该属性在原三方库上支持的平台。 @@ -162,21 +167,21 @@ export function RatingsDemo () { | Name | Description | Type | Required | Platform | HarmonyOS Support | | :-----------------------: | :-----------------------------------------------: | :------------------------------------------------------: | :------: | :---------: | :---------------: | -| **defaultRating** | Initial value for the rating | number | No | iOS/Android | Yes | -| **reviews** | Labels to show when each value is tapped e.g. If the first star is tapped, then value in index 0 will be used as the label | string | No | iOS/Android | Yes | -| **count** | Total number of ratings to display | number | No | iOS/Android | Yes | -| **selectedColor** | Pass in a custom fill-color for the rating icon | string | No | iOS/Android | Yes | -| **unSelectedColor** | Pass in a custom not fill-color for the rating icon | string | No | iOS/Android | Yes | -| **reviewColor** | Pass in a custom text color for the review text | string | No | iOS/Android | Yes | -| **size** | The size of each rating image (optional) | number | No | iOS/Android | Yes | -| **reviewSize** | Pass in a custom font size for the review text | number | No | iOS/Android | Yes | -| **showRating** | Determines if to show the reviews above the rating | boolean | No | iOS/Android | Yes | -| **isDisabled** | Whether the rating can be modiefied by the user | boolean | No | iOS/Android | Yes | -| **onFinishRating** | Callback method when the user finishes rating. Gives you the final rating value as a whole number | function | No | iOS/Android | Yes | -| **starContainerStyle** | Custom styles applied to the star container | object | No | iOS/Android | Yes | -| **ratingContainerStyle** | Custom styles applied to the rating container | object | No | iOS/Android | Yes | -| **starImage** | Pass in a custom base image source (optional) | string | No | iOS/Android | Yes | -| **starStyle** | Custom styles applied to the star (optional) | object | No | iOS/Android | Yes | +| **defaultRating** | 评分的初始值。 | number | No | iOS/Android | Yes | +| **reviews** | 点击每个值时显示的标签,例如:如果点击了第一颗星,则使用索引 0 处的值作为标签。 | string | No | iOS/Android | Yes | +| **count** | 显示的评分总数。 | number | No | iOS/Android | Yes | +| **selectedColor** | 传入评分图标的自定义填充颜色。 | string | No | iOS/Android | Yes | +| **unSelectedColor** | 传入评分图标的自定义未填充颜色。 | string | No | iOS/Android | Yes | +| **reviewColor** | 传入评论文本的自定义颜色。 | string | No | iOS/Android | Yes | +| **size** | 每个评分图片的大小(可选)。 | number | No | iOS/Android | Yes | +| **reviewSize** | 传入评论文本的自定义字体大小。 | number | No | iOS/Android | Yes | +| **showRating** | 决定是否在评分上方显示评论。 | boolean | No | iOS/Android | Yes | +| **isDisabled** | 用户是否可以修改评分。 | boolean | No | iOS/Android | Yes | +| **onFinishRating** | 用户完成评分时的回调方法。提供整数形式的最终评分值。 | function | No | iOS/Android | Yes | +| **starContainerStyle** | 应用于星星容器的自定义样式。 | object | No | iOS/Android | Yes | +| **ratingContainerStyle** | 应用于评分容器的自定义样式。 | object | No | iOS/Android | Yes | +| **starImage** | 传入自定义基础图片资源(可选)。 | string | No | iOS/Android | Yes | +| **starStyle** | 应用于星星的自定义样式(可选)。 | object | No | iOS/Android | Yes | ## 遗留问题 -- Gitee