Carousel component for React Native implemented by View instead of ScrollView.
Support IOS and Android.
Buy me a coffee if you like this
$ npm install react-native-spring-carousel --save
require('react-native-spring-carousel');
...
onPressSlide(index){
console.log(index);
},
render() {
return (
<Carousel
width={width}
height={height}
pagerColor="#000"
activePagerColor="#ff0000"
pagerSize={10}
pagerOffset={10}
pagerMargin={2}
speed={2000}
onPress={this.onPressSlide}
>
<View style={{width:width,height:300,backgroundColor:'#aaa',}}>
<Text>Page 1</Text>
</View>
<View style={{width:width,height:300,backgroundColor:'#bbb',}}>
<Text>Page 2</Text>
</View>
<View style={{width:width,height:300,backgroundColor:'#ccc',}}>
<Text>Page 3</Text>
</View>
</Carousel>
);
}
0.3.4 added support for RN 0.26 (thanks @cornedor )
0.3.2 remove listener onunmount
0.3.1 fixed onpress issue
0.3.0 added autoplay feature, you can define props - 'speed' to enable autoplay, remove speed to disable autoplay
0.2.1 bugs fixed
0.2.0 added onPress callback
custom styles