Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zbtang/React-Native-ViewPager

ViewPager and Indicator component for react-native on both android and ios.
https://github.com/zbtang/React-Native-ViewPager

react-native viewpager

Last synced: about 2 months ago
JSON representation

ViewPager and Indicator component for react-native on both android and ios.

Awesome Lists containing this project

README

        

# React-Native-ViewPager
[![npm](https://img.shields.io/npm/v/rn-viewpager.svg?style=plastic)](https://npmjs.org/package/rn-viewpager) [![npm](https://img.shields.io/npm/dm/rn-viewpager.svg?style=plastic)](https://npmjs.org/package/rn-viewpager) [![npm](https://img.shields.io/npm/dt/rn-viewpager.svg?style=plastic)](https://npmjs.org/package/rn-viewpager)

ViewPager and Indicator component for react-native on both android and ios. ViewPager's props is the same as [ViewPagerAndroid](https://facebook.github.io/react-native/docs/viewpagerandroid.html#content).



## Features
- unify \ and \ to \, add offer same props as [ViewPagerAndroid](https://facebook.github.io/react-native/docs/viewpagerandroid.html#content).
- \ component support render indicator
- implement common indicator: DotIndicator, TitleIndicator and TabIndicator

## Preview
[download demo apk file](http://fir.im/md2u)





## Build and run the demo

```
cd RNViewPagerDemo/
npm install
react-native run-ios
```

## Component API

[`` Component API](docs/viewpager.md)

[`` Component API](docs/indicatorviewpager.md)

[`` Component API](docs/dotindicator.md)

[`` Component API](docs/tabindicator.md)

[`` Component API](docs/titleindicator.md)

## Usage

### Install from npm:
`npm install --save rn-viewpager`

### Integrate into your app:

```jsx

import {StyleSheet, View, Text} from 'react-native';
import React, {Component} from 'react';
import {PagerTabIndicator, IndicatorViewPager, PagerTitleIndicator, PagerDotIndicator} from 'rn-viewpager';

export default class ViewPagerPage extends Component {
render() {
return (



page one


page two


page three



page one


page two


page three





page one


page two


page three



);
}

_renderTitleIndicator() {
return ;
}

_renderDotIndicator() {
return ;
}

_renderTabIndicator() {
let tabs = [{
text: 'Home',
iconSource: require('../imgs/ic_tab_home_normal.png'),
selectedIconSource: require('../imgs/ic_tab_home_click.png')
},{
text: 'Message',
iconSource: require('../imgs/ic_tab_task_normal.png'),
selectedIconSource: require('../imgs/ic_tab_task_click.png')
},{
text: 'Profile',
iconSource: require('../imgs/ic_tab_my_normal.png'),
selectedIconSource: require('../imgs/ic_tab_my_click.png')
}];
return ;
}

}
```

## Note

When use this lib in ListView header on android platform, please add `removeClippedSubviews={false}` prop to your ListView.