1.2.5 • Published 4 years ago

react-native-card-stack-swiper v1.2.5

Weekly downloads
1,710
License
MIT
Repository
github
Last release
4 years ago

react-native-card-stack-swiper

Tinder like react-native card stack swiper

contributions welcome npm version npm downloads

Installation

  npm install --save react-native-card-stack-swiper

Preview

App preview App preview2

import CardStack, { Card } from 'react-native-card-stack-swiper';
  <CardStack style={styles.content} ref={swiper => { this.swiper = swiper }}>
    <Card style={[styles.card, styles.card1]}><Text style={styles.label}>A</Text></Card>
    <Card style={[styles.card, styles.card2]}><Text style={styles.label}>B</Text></Card>
    <Card style={[styles.card, styles.card1]}><Text style={styles.label}>C</Text></Card>
  </CardStack>

CardStack

CardStack props

Propstypedescriptionrequireddefault
styleobjectcontainer style{}
cardContainerStyleobjectcardContainerStyle style{}
secondCardZoomnumbersecond card zoom0.95
durationnumberanimation duration300
initialIndexnumberinitial card index0
loopboolkeep swiping indefinitelyfalse
renderNoMoreCardsfuncfalse
disableTopSwipebooldisable top swipefalse
disableBottomSwipebooldisable bottom swipefalse
disableLeftSwipebooldisable left swipefalse
disableRightSwipebooldisable right swipefalse
verticalSwipeboolenable/disable vertical swipingtrue
horizontalSwipeboolenable/disable horizont swipingtrue
verticalThresholdnumbervertical swipe thresholdheight/4
horizontalThresholdnumberhorizontal swipe thresholdwidth/2
outputRotationRangearrayrotation values for the x values'-15deg', '0deg', '15deg'

CardStack events

Propstypedescription
onSwipeStartfuncfunction to be called when a card swipe starts
onSwipeEndfuncfunction to be called when a card swipe ends (card is released)
onSwipedfuncfunction to be called when a card is swiped. it receives the swiped card index
onSwipedLeftfuncfunction to be called when a card is swiped left. it receives the swiped card index
onSwipedRightfuncfunction to be called when a card is swiped right. it receives the swiped card index
onSwipedTopfuncfunction to be called when a card is swiped top. it receives the swiped card index
onSwipedBottomfuncfunction to be called when a card is swiped bottom. it receives the swiped card index
onSwipedAllasync funcfunction to be called when the last card is swiped. Could trig action to refresh cards
onSwipefuncfunction to be called when a card is swiped. It receives the current x, and y coordinates

CardStack actions

Propstype
swipeLeftfunc
swipeRightfunc
swipeBottomfunc
swipeTopfunc
goBackFromLeftfunc
goBackFromRightfunc
goBackFromBottomfunc
goBackFromTopfunc
  <CardStack style={styles.content} ref={swiper => { this.swiper = swiper }}>
    <Card style={[styles.card, styles.card1]}><Text style={styles.label}>A</Text></Card>
    <Card style={[styles.card, styles.card2]}><Text style={styles.label}>B</Text></Card>
  </CardStack>

  <TouchableOpacity onPress={ () => { this.swiper.swipeLeft() }}>
    <Text>Left</Text>
  </TouchableOpacity>

Card

Card props

Propstypedescriptionrequireddefault
styleobjectcontainer style{}

Card events

Propstypedescription
onSwipedfuncfunction to be called when a card is swiped.
onSwipedLeftfuncfunction to be called when a card is swiped left.
onSwipedRightfuncfunction to be called when a card is swiped right.
onSwipedTopfuncfunction to be called when a card is swiped top.
onSwipedBottomfuncfunction to be called when a card is swiped bottom.
1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.0

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

4 years ago

1.1.5

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.1

4 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

6 years ago

1.0.6

6 years ago

1.0.7

6 years ago

1.0.5

6 years ago

1.0.48

6 years ago

1.0.47

6 years ago

1.0.46

6 years ago

1.0.45

6 years ago

1.0.35

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago