diff --git a/zh-cn/react-native-reanimated-carousel.md b/zh-cn/react-native-reanimated-carousel.md
index 2606df6b146c1b10c6e0c1175cefe5891ef09ec4..cbcfb8c34f30070aff20794aae874402ad548fff 100644
--- a/zh-cn/react-native-reanimated-carousel.md
+++ b/zh-cn/react-native-reanimated-carousel.md
@@ -1,5 +1,4 @@
-
-> 模板版本:v0.1.3
+> 模板版本:v0.2.2
react-native-reanimated-carousel
@@ -8,9 +7,12 @@
+
+
+
-> [!tip] [Github 地址](https://github.com/dohooo/react-native-reanimated-carousel)
+> [!TIP] [Github 地址](https://github.com/dohooo/react-native-reanimated-carousel)
## 安装与使用
@@ -34,258 +36,117 @@ npm install react-native-reanimated-carousel@^3.5.1
下面的代码展示了这个库的基本使用场景:
+> [!WARNING] 使用时 import 的库名不变。
+
```js
import * as React from "react";
-import { ScrollView } from "react-native-gesture-handler";
import type { ICarouselInstance } from "react-native-reanimated-carousel";
import Carousel from "react-native-reanimated-carousel";
-import { SafeAreaView } from "react-native-safe-area-context";
+import { View, Text, Button } from "react-native";
+import { useSharedValue } from "react-native-reanimated";
-import SButton from "./components/SButton";
-import { ElementsText, window } from "./constants";
-import { useWindowDimensions, View, Text, Button } from "react-native";
-import { useSharedValue } from "@react-native-oh-tpl/react-native-reanimated";
-const PAGE_WIDTH = window.width;
-
-function App() {
- const windowWidth = useWindowDimensions().width;
+export function ReanimaDemo() {
const scrollOffsetValue = useSharedValue(1);
const [data, setData] = React.useState([...new Array(4).keys()]);
- const [isVertical, setIsVertical] = React.useState(false);
- const [isFast, setIsFast] = React.useState(false);
- const [isAutoPlay, setIsAutoPlay] = React.useState(true);
- const [isPagingEnabled, setIsPagingEnabled] = React.useState(true);
const [value, setValue] = React.useState(0);
const ref = React.useRef(null);
- const baseOptions = isVertical
- ? ({
- vertical: true,
- width: windowWidth,
- height: PAGE_WIDTH / 2,
- } as const)
- : ({
- vertical: false,
- width: windowWidth,
- height: PAGE_WIDTH / 2,
- } as const);
-
return (
-
+
{console.log('===1')}}
- onScrollEnd={() => { console.log('===2') }}
-
- // onConfigurePanGesture={g => g.enabled(false)}
- pagingEnabled={isPagingEnabled}
onSnapToItem={index => setValue(index)}
- renderItem={({ index }) => {return
-
- {`slide${value + 1}`}
-
- }}
- />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ >
+
+ {`slide${value + 1}`}
+
+
+ }}
+ />
+
+
+
+
+
+
+
+
);
}
-export default App;
-
```
## Link
本库 HarmonyOS 侧实现依赖@react-native-oh-tpl/react-native-reanimated 的原生端代码,如已在 HarmonyOS 工程中引入过该库,则无需再次引入,可跳过本章节步骤,直接使用。
-如未引入请参照[@react-native-oh-tpl/react-native-reanimated 文档的 Link 章节](/zh-cn/react-native-reanimated.md#link)进行引入
+如未引入请参照[@react-native-oh-tpl/react-native-reanimated 文档](/zh-cn/react-native-reanimated.md#link)进行引入
+
+本库 HarmonyOS 侧实现依赖@react-native-oh-tpl/react-native-gesture-handler 的原生端代码,如已在 HarmonyOS 工程中引入过该库,则无需再次引入,可跳过本章节步骤,直接使用。
+
+如未引入请参照[@react-native-oh-tpl/react-native-gesture-handler 文档](/zh-cn/react-native-gesture-handler.md#link)进行引入
## 约束与限制
@@ -293,31 +154,28 @@ export default App;
在下述版本验证通过:
-1. RNOH:0.72.11; SDK:OpenHarmony(api11) 4.1.0.53; IDE:DevEco Studio 4.1.3.412; ROM:2.0.0.52;
-2. RNOH:0.72.13; SDK:HarmonyOS NEXT Developer Preview1; IDE:DevEco Studio 4.1.3.500; ROM:2.0.0.59;
+1. RNOH:0.72.28; SDK:HarmonyOS-NEXT-DB2; IDE:DevEco Studio 5.0.3.500; ROM:205.0.0.35;
## API
> [!tip] "Platform"列表示该属性在原三方库上支持的平台。
> [!tip] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
->
-> 详情见 [react-native-reanimated-carousel 源库地址](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/README.md)
-| 名称 | 描述 | 参数类型 | 是否必填 | Platform | HarmonyOS Support |
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
| ------------------------ | -------------------------------------------------------------- | -------- | -------- | -------- | ----------------- |
-| data | 要显示的数据数组 | array | yes | All | yes |
-| renderItem | 渲染每个项目的函数。接收一个参数 index,表示当前项的索引 | func | yes | All | yes |
-| loop | 是否循环播放 | boolean | yes | All | yes |
-| enabled | 是否启用轮播图功能 | boolean | yes | All | yes |
-| autoPlay | 是否自动播放 | boolean | yes | All | yes |
-| autoPlayInterval | 自动播放的时间间隔(以毫秒为单位) | number | yes | All | yes |
-| defaultScrollOffsetValue | 初始滚动偏移值 | number | yes | All | yes |
-| onScrollStart | 滚动开始时的回调函数 | func | yes | All | yes |
-| onScrollEnd | 滚动结束时的回调函数 | func | yes | All | yes |
-| onSnapToItem | 切换到新项目时的回调函数。接收一个参数 index,表示新项目的索引 | func | yes | All | yes |
-| pagingEnabled | 是否启用分页滚动 | boolean | yes | All | yes |
-| scrollTo | 滚动到指定项的方法 | func | yes | All | yes |
+| data | 要显示的数据数组 | array | yes | Android/iOS | yes |
+| renderItem | 渲染每个项目的函数。接收一个参数 index,表示当前项的索引 | function | yes | Android/iOS | yes |
+| loop | 是否循环播放 | boolean | yes | Android/iOS | yes |
+| enabled | 是否启用轮播图功能 | boolean | yes | Android/iOS | yes |
+| autoPlay | 是否自动播放 | boolean | yes | Android/iOS | yes |
+| autoPlayInterval | 自动播放的时间间隔(以毫秒为单位) | number | yes | Android/iOS | yes |
+| defaultScrollOffsetValue | 初始滚动偏移值 | number | yes | Android/iOS | yes |
+| onScrollStart | 滚动开始时的回调函数 | function | yes | Android/iOS | yes |
+| onScrollEnd | 滚动结束时的回调函数 | function | yes | Android/iOS | yes |
+| onSnapToItem | 切换到新项目时的回调函数。接收一个参数 index,表示新项目的索引 | function | yes | Android/iOS | yes |
+| pagingEnabled | 是否启用分页滚动 | boolean | yes | Android/iOS | yes |
+| scrollTo | 滚动到指定项的方法 | function | yes | Android/iOS | yes |
## 遗留问题
@@ -325,6 +183,4 @@ export default App;
## 开源协议
-本项目基于 [The MIT License (MIT)](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/LICENSE) ,请自由地享受和参与开源。
-
-
\ No newline at end of file
+本项目基于 [The MIT License (MIT)](https://github.com/dohooo/react-native-reanimated-carousel/blob/main/LICENSE) ,请自由地享受和参与开源。
\ No newline at end of file