1.5.3 • Published 5 years ago

react-native-swiper-animated v1.5.3

Weekly downloads
33
License
MIT
Repository
github
Last release
5 years ago

react-native-swiper-animated

Tinder like animations swiper for React Native

ATTENTION! THIS PACKAGE IS CURRENTLY UNMAINTAINED!!

I am currently working on the v2, it's based on react-native-gesture-handler instead of RN's PanResponder. I will be more performant, cleaner and tested.

Installation

$ npm i react-native-swiper-animated --save

Shots

BasicStackExtended

In Action

BasicStackStack with default navigation

Basic Usage

import React from 'react';
import {
  Text,
  View,
} from 'react-native';
import Swiper from 'react-native-swiper-animated';

const styles = {
  wrapper: {
    backgroundColor: '#009688',
  },
  slide1: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#e91e63',
  },
  slide2: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#673ab7',
  },
  slide3: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#3f51b5',
  },
  text: {
    color: '#fff',
    fontSize: 30,
    fontWeight: 'bold',
  },
};

export default () => <Swiper
  style={styles.wrapper}
  smoothTransition
  loop
>
  <View style={styles.slide1}>
    <Text style={styles.text}>Hello Swiper</Text>
  </View>
  <View style={styles.slide2}>
    <Text style={styles.text}>Beautiful</Text>
  </View>
  <View style={styles.slide3}>
    <Text style={styles.text}>And simple</Text>
  </View>
</Swiper>;

Examples

$ cd examples
$ npm i
$ react-native run-android

Quick start with examples.

Properties

Basic

PropDefaultTypeDescription
smoothTransitionfalseboolIf true, Swiper will only transit with minimal animations
looptrueboolSet to false to disable continuous loop mode.
index0numberIndex number of initial slide.
stackfalseboolSet to true to stack views
swipertrueboolSet to false to disable swiper (used when navigating using methods only)
swipeDirectionrightstringSet to left to move to next card on left swipe

Custom

PropDefaultTypeDescription
style{...}styleSee default style in source.
swiperThreshold120numberUsed to set swiper distance before transition
backPressToBacktrueboolSet to false to disable previous card nagivation on back press
stackOffsetY3numberSet vertical offset
stackDepth5numberSet number of cards to display in card stack
scaleOtherstrueboolSet to false to disable scaling of cards below the top card

Pagination

PropDefaultTypeDescription
showPaginationtrueboolSet to false to disable pagination
paginationDotColor#C5C5C5stringIn active pagination bullet color
paginationActiveDotColor#4D4D4EstringActive pagination bullet color
showPaginationBelowfalseboolSet to true to render pagination below content
hidePaginationOnLastfalseboolSet to true to hide pagination on last card
renderPaginationnullfuncrender custom pagination - calls func with (total, currentIndex)

Toolbar

PropDefaultTypeDescription
renderHeader() => {}funccalled with the current index

react-native-material-ui was removed in version 1.5.0, you will have to call renderHeader to render a custom header

Discover more

Methods

forceLeftSwipe()

Swiper to left

forceRightSwipe()

Swiper to right

jumpToIndex(index: number)

Jump to a particular index

Development

$ cd examples
$ npm i
$ npm run watch
$ react-native run-android

Contribution

Questions

Feel free to contact me or create an issue

Inspired by leecade/Swiper and Tinder swiper by @brentvatne

1.5.3

5 years ago

1.5.2

5 years ago

1.5.1

6 years ago

1.5.0

6 years ago

1.4.1

6 years ago

1.4.0

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.6

7 years ago

1.2.5

7 years ago

1.2.4

7 years ago

1.2.3

7 years ago

1.2.2

7 years ago

1.2.1

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.9.0

7 years ago

0.8.1

7 years ago

0.8.0

7 years ago

0.7.3

7 years ago

0.7.2

7 years ago

0.7.1

7 years ago

0.7.0

7 years ago

0.6.1

7 years ago

0.6.0

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.2

7 years ago

0.4.1

7 years ago

0.3.0

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago