# react-native-pager-carousel

> A performant Pager/Carousel for react-native

Latest version **0.0.4** (published 2024-08-15) · 0 weekly downloads

## Install

```sh
npm install react-native-pager-carousel
pnpm add react-native-pager-carousel
yarn add react-native-pager-carousel
bun add react-native-pager-carousel
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2024-08-15 |
| First published | 2020-02-02 |
| Weekly downloads | 0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 31.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Damien Solimando |
| Maintainers | dsolimando |
| Keywords | react-native, carousel, pager |

## Links

- npm: https://www.npmjs.com/package/react-native-pager-carousel
- npm.io page: https://npm.io/package/react-native-pager-carousel

## Dependencies (1)

- [@react-native-community/viewpager](https://npm.io/package/@react-native-community/viewpager.md) ^2.0.2

## Alternatives

- [adhdev](https://npm.io/package/adhdev.md) — 11.1K weekly downloads
- [react-slide-button](https://npm.io/package/react-slide-button.md) — 310 weekly downloads
- [better](https://npm.io/package/better.md) — 42 weekly downloads
- [react-native-swipe-image](https://npm.io/package/react-native-swipe-image.md) — 22 weekly downloads
- [nl.fokkezb.pulltorefresh](https://npm.io/package/nl.fokkezb.pulltorefresh.md) — 11 weekly downloads

## Recent versions

- 0.0.4 (latest) — 2024-08-15
- 0.0.3 — 2020-02-05
- 0.0.2 — 2020-02-05
- 0.0.2-beta5 — 2020-02-04
- 0.0.2-beta4 — 2020-02-04
- 0.0.2-beta3 — 2020-02-04
- 0.0.2-beta2 — 2020-02-04
- 0.0.2-beta1 — 2020-02-04
- 0.0.1 — 2020-02-02

## README

# react-native-pager-carousel

A native based Pager/Carousel. It uses FlatList on iOS and ViewPagerAndroid on Android to assure 60 FPS performance.

# Installation

```bash
# npm install react-native-pager-carousel
```

# Usage

````typescript jsx
import { Image } from 'react-native';
import { Pager } from 'react-native-pager-carousel';

//...

<Pager
    data={[
        { id: 1, url: 'image1'},
        { id: 2, url: 'image2'},
    ]}
    
    renderItem={ item => <Image
                key={item.id}
                style={{width: 50, height: 50}}
                source={{uri: item.url}}
              />}   
     
/>
````

### Putting space around item

 ```typescript jsx
 import { Image } from 'react-native';
 import { Pager } from 'react-native-pager-carousel';
 
 //...
 
 <Pager
     data={[
         { id: 1, url: 'image1'},
         { id: 2, url: 'image2'},
     ]}
     
     renderItem={ item => <Image
                 key={item.id}
                 style={{width: 50, height: 50}}
                 source={{uri: item.url}}
               />}   
      
     marginHorizontal={20}    
 />
 ```

### Preview previous and next item

 ```typescript jsx
 import { Image } from 'react-native';
 import { Pager } from 'react-native-pager-carousel';
 
 //...
 
 <Pager
     data={[
         { id: 1, url: 'image1'},
         { id: 2, url: 'image2'},
     ]}
     
     renderItem={ item => <Image
                 key={item.id}
                 style={{width: 50, height: 50}}
                 source={{uri: item.url}}
               />}   
      
     distanceBetweenItems={20}    
 />
 ```

### Render a specific item at mount

 ```typescript jsx
 import { Image } from 'react-native';
 import { Pager } from 'react-native-pager-carousel';
 
 //...
 
 <Pager
     data={[
         { id: 1, url: 'image1'},
         { id: 2, url: 'image2'},
     ]}
     
     renderItem={ item => <Image
                 key={item.id}
                 style={{width: 50, height: 50}}
                 source={{uri: item.url}}
               />}   
      
     initialItemToRenderIndex={1}    
 />
 ```

# List of Props

```typescript jsx
 <Pager
    data={[]}                        // Array of objetcs containing data
    renderItem={() => <View/>}       // funtion that display carousel entry
    distanceBetweenItems={20}        // insert space between items allowing to preview next and previous item (Optional)
    marginHorizontal={20}            // put space arount displayed item (Optional)
    initialItemToRenderIndex={1}     // initial item rendered when mounting item (Optional)
    animated={true}                  // animate the scrolling to initial item to render (Optional)
    onPageSelected={() => null}      // function called when swiping between items (Optional)
    onScroll={() => null}            // function called on each scroll event (Optional)
 />
 ```

---
_Source: https://npm.io/package/react-native-pager-carousel · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
