Skip to content

Commit c20d2fd

Browse files
committed
docs: update readme
#101
1 parent 3d9b62a commit c20d2fd

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

docs/props.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454

5555
| name | types | description |
5656
| --------------- | ------------------------------------------- | ---------------------- |
57-
| prev | (count?: number)=>void | Scroll to previous item, it takes one optional argument (count), which allows you to specify how many items to cross |
58-
| next | (count?: number)=>void | Scroll to next item, it takes one optional argument (count), which allows you to specify how many items to cross |
59-
| scrollTo | (value: number, animated?: boolean) => void | Use value to scroll to a position where relative to the current position, scrollTo(-2) is equivalent to prev(2), scrollTo(2) is equivalent to next(2) |
57+
| prev | ({ count = 1, animated = false, onFinished?: () => void }) => void | Scroll to previous item, it takes one optional argument (count), which allows you to specify how many items to cross |
58+
| next | ({ count = 1, animated = false, onFinished?: () => void }) => void | Scroll to next item, it takes one optional argument (count), which allows you to specify how many items to cross |
59+
| scrollTo | ({ count = 1, animated = false, onFinished?: () => void }) => void | Use count to scroll to a position where relative to the current position, scrollTo(-2) is equivalent to prev(2), scrollTo(2) is equivalent to next(2) |
6060
| goToIndex | (index: number, animated?: boolean) => void | Go to index |
6161
| getCurrentIndex | ()=>number | Get current item index |

docs/props.zh-CN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454

5555
| name | types | description |
5656
| --------------- | ------------------------------------------- | ------------------ |
57-
| prev | (count?: number = 1)=>void | 切换至上一项,可以指定`count`决定切换的数量 |
58-
| next | (count?: number = 1)=>void | 切换至下一张,可以指定`count`决定切换的数量 |
59-
| scrollTo | (value: number, animated?: boolean)=>void | 切换到距离当前相对位置为`value`的位置,`scrollTo(-2)`等价于`prev(2)``scrollTo(2)`等价于`next(2)` |
57+
| prev | ({ count = 1, animated = false, onFinished?: () => void }) => void | 切换至上一项,可以指定`count`决定切换的数量 |
58+
| next | ({ count = 1, animated = false, onFinished?: () => void }) => void | 切换至下一张,可以指定`count`决定切换的数量 |
59+
| scrollTo | ({ count = 1, animated = false, onFinished?: () => void }) => void | 切换到距离当前相对位置为`count`的位置,`scrollTo(-2)`等价于`prev(2)``scrollTo(2)`等价于`next(2)` |
6060
| (弃用)goToIndex | (index: number, animated?: boolean) => void | 切换至指定下标元素 |
6161
| getCurrentIndex | ()=>number | 获得当前轮播图下标 |

example/src/advanced-parallax/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ function Index() {
5252
);
5353
}}
5454
customAnimation={animationStyle}
55+
scrollAnimationDuration={1200}
5556
/>
5657
<SButton
5758
onPress={() => {

example/src/pause-advanced-parallax/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ function Index() {
5252
);
5353
}}
5454
customAnimation={animationStyle}
55+
scrollAnimationDuration={1200}
5556
/>
5657
<SButton
5758
onPress={() => {

src/hooks/useCarouselController.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,15 @@ export function useCarouselController(options: IOpts): ICarouselController {
226226

227227
const scrollTo = React.useCallback(
228228
(opts: TCarouselActionOptions = {}) => {
229-
const { count, animated = false } = opts;
229+
const { count, animated = false, onFinished } = opts;
230230
if (!count) {
231231
return;
232232
}
233233
const n = Math.round(count);
234234
if (n < 0) {
235-
prev({ count: Math.abs(n), animated });
235+
prev({ count: Math.abs(n), animated, onFinished });
236236
} else {
237-
next({ count: n, animated });
237+
next({ count: n, animated, onFinished });
238238
}
239239
},
240240
[prev, next]

0 commit comments

Comments
 (0)