Giter Site home page Giter Site logo

react-native-ezswiper's Introduction

react-native-ezswiper

中文文档

NPM version release GitHub license

source is simple, easy to use card swiper for React Native on iOS&android.

Installation

$ npm install react-native-ezswiper --save

Preview

showios showandroid

Usage

import library:

import EZSwiper from 'react-native-ezswiper';

simple swiper

<EZSwiper style={{width: width,height: 150,backgroundColor: 'white'}}
          dataSource={['0', '1' ,'2','3']}
          width={ width }
          height={150 }
          renderRow={this.renderRow}
          onPress={this.onPressRow}                      
          />

card swiper

<EZSwiper style={{width: width,height: 150,backgroundColor: 'white'}}
           dataSource={images}
           width={ width }
           height={150 }
           renderRow={this.renderImageRow}
           onPress={this.onPressRow} 
           ratio={0.867}                    
                    />

advanced

<EZSwiper style={{width: width,height: 150,backgroundColor: 'white'}}
                    dataSource={['0', '1' ,'2','3']}
                    width={ width }
                    height={150 }
                    renderRow={this.renderRow}
                    onPress={this.onPressRow} 
                    index={2}                
                    cardParams={{cardSide:width*0.867, cardSmallSide:150*0.867,cardSpace:width*(1-0.867)/2*0.2}}  
                    />

vertical swiper

<EZSwiper style={{width: width,height: 200,backgroundColor: 'white'}}
          dataSource={['0', '1' ,'2','3']}
          width={ width }
          height={200 }
          renderRow={this.renderRow}
          onPress={this.onPressRow} 
          ratio={0.867} 
          horizontal={false}  
                    />

API

Props

key type default description
width PropTypes.number.isRequired swiper width
height PropTypes.number.isRequired swiper height
index PropTypes.number 0 initial index
horizontal PropTypes.bool true swiper derection is horizontal
loop PropTypes.bool true swiper is loop
autoplayTimeout PropTypes.number 5 auto play mode (in second)
autoplayDirection PropTypes.bool true cycle direction control
ratio PropTypes.number 1 scaling ratio
cardParams PropTypes.object {} swiper card advanced object
renderRow PropTypes.func.isRequired render card view
onPress PropTypes.func card is clicked action
onWillChange PropTypes.func next card will show
onDidChange PropTypes.func next card showed

cardParams is object:{cardSide,cardSmallSide,cardSpace}

cardParams

Function

function description
scrollTo(index, animated = true) scroll to position

License

MIT License. © Zhu Yangjun 2017

react-native-ezswiper's People

Contributors

easyui avatar zhazhengrefn avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.