Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5.3.0 #1384

Closed
wants to merge 20 commits into from
Closed

5.3.0 #1384

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions components/carousel/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@ title: Carousel

## API

Properties | Descrition | Type | Default
-----------|------------|------|--------
| afterChange | callback to be called after a slide is changed | (current: number) => void | |
| autoplay | autoplay mode active | Boolean | false |
| autoplayInterval | interval for autoplay iteration | Number | 3000 |
| dots | whether to display the indication dots | Boolean | true |
| dotStyle | style of dots | ViewStyle | |
| dotActiveStyle | style of active dot | ViewStyle | |
| infinite | whether is infinite loop | Boolean | false |
| pageStyle | style of the carousel page | ViewStyle | |
| pagination | A generator function which could be used to customized pagination. | (props) => ReactNode | |
| selectedIndex | current selected index | number | 0 |
| style | ScrollView style<br/>(`tips: Recommended setting, the overall carousel size is determined by the container scrollview and not the inner page`) | ViewStyle | |
| vertical | controls the pagination display direction. | Boolean | false |
Properties | Descrition | Type | Default | Version
-----------|------------|------|---------|----------
| afterChange | callback to be called after a slide is changed | (current: number) => void | | |
| autoplay | autoplay mode active | Boolean | false | |
| autoplayInterval | interval for autoplay iteration | Number | 3000 | |
| dots | whether to display the indication dots | Boolean | true | |
| dotStyle | style of dots | ViewStyle | | |
| dotActiveStyle | style of active dot | ViewStyle | | |
| infinite | whether is infinite loop | Boolean | false | |
| pageStyle | style of the carousel page | ViewStyle | | |
| pagination | A generator function which could be used to customized pagination. | (props) => ReactNode | | |
| selectedIndex | current selected index | number | 0 | |
| style | ScrollView style<br/>(`tips: Recommended setting, the overall carousel size is determined by the container scrollview and not the inner page`) | ViewStyle | | |
| vertical | controls the pagination display direction. | Boolean | false | |
| onScrollAnimationEnd | Called when a scrolling animation ends. | ()=>void | | `5.3.0` |

The rest of the props of Carousel are exactly the same as the react-native [ScrollView](https://reactnative.dev/docs/scrollview.html);

Expand Down
8 changes: 6 additions & 2 deletions components/carousel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ class Carousel extends React.PureComponent<CarouselProps, CarouselState> {
if (isScrollAnimationEnd) {
this.updateIndex(currentOffset)
this.autoplay()
if (this.props.onScrollAnimationEnd) {
this.props.onScrollAnimationEnd()
}
}
}

Expand Down Expand Up @@ -249,7 +252,7 @@ class Carousel extends React.PureComponent<CarouselProps, CarouselState> {
},
() => {
// web & android
this.scrollview?.current?.scrollTo({ ...offset, animated: true })
this.scrollview?.current?.scrollTo({ ...offset, animated: false })
this.autoplay()
},
)
Expand Down Expand Up @@ -440,7 +443,8 @@ class Carousel extends React.PureComponent<CarouselProps, CarouselState> {
onScrollEndDrag={this.onScrollEndDrag}
onScroll={this.onScroll}
onTouchStart={this.onTouchStartForWeb}
onTouchEnd={this.onTouchEndForWeb}>
onTouchEnd={this.onTouchEndForWeb}
onScrollAnimationEnd={undefined}>
{pages}
</ScrollView>
)
Expand Down
29 changes: 15 additions & 14 deletions components/carousel/index.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,21 @@ subtitle: 走马灯

## API

属性 | 说明 | 类型 | 默认值
----|-----|------|------
| afterChange | 切换面板后的回调函数 | (current: number) => void | 无 |
| autoplay | 是否自动切换 | Boolean | false |
| autoplayInterval | 自动切换的时间间隔 | Number | 3000 |
| dots | 是否显示面板指示点 | Boolean | true |
| dotStyle | 指示点样式 | ViewStyle | 无 |
| dotActiveStyle | 当前激活的指示点样式 | ViewStyle | 无 |
| infinite | 是否循环播放 | Boolean | false |
| pageStyle | 轮播页内样式 | ViewStyle | 无 |
| pagination | 自定义 pagination | (props) => ReactNode | |
| selectedIndex | 手动设置当前显示的索引 | number | 0 |
| style | 轮播容器样式<br/>(建议设置,整体轮播大小由容器决定非页内决定) | ViewStyle | 无 |
| vertical | 垂直显示 | Boolean | false |
属性 | 说明 | 类型 | 默认值 | 版本
----|-----|------|-------|-----
| afterChange | 切换面板后的回调函数 | (current: number) => void | 无 | |
| autoplay | 是否自动切换 | Boolean | false | |
| autoplayInterval | 自动切换的时间间隔 | Number | 3000 | |
| dots | 是否显示面板指示点 | Boolean | true | |
| dotStyle | 指示点样式 | ViewStyle | 无 | |
| dotActiveStyle | 当前激活的指示点样式 | ViewStyle | 无 | |
| infinite | 是否循环播放 | Boolean | false | |
| pageStyle | 轮播页内样式 | ViewStyle | 无 | |
| pagination | 自定义 pagination | (props) => ReactNode | | |
| selectedIndex | 手动设置当前显示的索引 | number | 0 | |
| style | 轮播容器样式<br/>(建议设置,整体轮播大小由容器决定非页内决定) | ViewStyle | 无 | |
| vertical | 垂直显示 | Boolean | false | |
| onScrollAnimationEnd | 当滚动动画结束时调用 | ()=>void | 无 | `5.3.0` |


Carousel 的其他属性和 react-native 内置组件[ScrollView](https://reactnative.dev/docs/scrollview.html) 一致;<br/>
Expand Down
Loading