react-native-spring-carousel

0.3.4 • Public • Published

react-native-spring-carousel

Carousel component for React Native implemented by View instead of ScrollView.

Support IOS and Android.

My image

Buy me a coffee if you like this

Install

$ npm install react-native-spring-carousel --save

Usage

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>
          );
      }

Update

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

todo

custom styles

Package Sidebar

Install

npm i react-native-spring-carousel

Weekly Downloads

12

Version

0.3.4

License

MIT

Last publish

Collaborators

  • notlose