jackyanjiaqi / react-native-viewpager

ViewPager component for React Native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-native-viewpager

npm version npm downloads

This is the ViewPager componnent in React Native both for Android and iOS. This is a JavaScript-only implementation of pager for React Native. Like ListView, this can render hundreds of pages without performance issue. Better than the one in Android, this ViewPager can auto play -- turn page automaticly, loop -- make infinite scrolling.

Demo

Demo project is here.

Usage

  1. Run npm install react-native-viewpager --save
  2. Code like this:
var ViewPager = require('react-native-viewpager');
<ViewPager
    dataSource={this.state.dataSource}
    renderPage={this._renderPage}/>

More configuration

  • dataSource: this is require to provide pages data,
  • renderPage: this is require to render page view,
  • autoPlay: true to turn page automaticly,
  • isLoop: true to run in infinite scroll mode,
  • locked: true to disable touch scroll,
  • onChangePage: page change callback,
  • renderPageIndicator: render custom ViewPager indicator.

Licensed

MIT License

About

ViewPager component for React Native


Languages

Language:JavaScript 70.8%Language:Objective-C 20.2%Language:Java 9.1%