warn example import * as React from 'react' ; import { StyleSheet , } from 'react-native' ; import { noop } from '../../utils' ; import { SwiperProps } from './PropsType' ; import Carousel from './carousel' ; class _Swiper extends React . Component < SwiperProps > { static defaultProps = { indicatorColor : 'rgba(0,0,0,0.3)' , indicatorActiveColor : '#000' , current : 0 , interval : 5000 , } ; onIndexChanged = ( index ) : void => { const { onChange = noop , onAnimationFinish = noop } = this . props ; onChange ( { detail : { current : index } } ) ; onAnimationFinish ( { detail : { current : index } } ) ; } ; render ( ) { const { children , style , indicatorDots , indicatorColor , indicatorActiveColor , autoplay , current , interval , circular , vertical , } = this . props ; return ( < Carousel style = { StyleSheet . flatten ( style ) } dots = { Boolean ( indicatorDots ) } dotStyle = { { backgroundColor : indicatorColor } } dotActiveStyle = { { backgroundColor : indicatorActiveColor } } autoplay = { Boolean ( autoplay ) } selectedIndex = { current } autoplayInterval = { interval } infinite = { Boolean ( circular ) } vertical = { Boolean ( vertical ) } afterChange = { this . onIndexChanged } > { children } < /Carousel>); } } export default _Swiper ;