Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-deck-swiper

Package Overview
Dependencies
Maintainers
1
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-deck-swiper

Awesome tinder like card swiper for react-native. Highly Customizable!

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

React Native Swiper component

contributions welcome Standard - JavaScript Style Guide

Preview

App preview

Props

Propstypedescriptionrequired or default
cardsarrayarray of data for the cards to be renderedrequired
renderCardfuncfunction to render the card based on the datarequired
onSwipedAllfuncfunction to be called when all cards have been swiped() => {}
onSwipedfuncfunction to be called when a card is swiped. it receives the new card index(cardIndex) => {}
cardIndexnumbercardIndex to start with0
infiniteboolkeep swiping indefinitelyfalse
verticalThresholdnumbervertical swipe thresholdheight / 5
horizontalThresholdnumberhorizontal swipe thresholdwidth / 4
secondCardZoomnumbersecond card zoom0.97
backgroundColornumberbackground color for the view containing the cards'#4FD0E9'
outputRotationRangearrayrotation values for the x values in inputRotationRange["-10deg", "0deg", "10deg"]
inputRotationRangearrayx values range for the rotation output[-width / 2, 0, width / 2]
cardTopMarginnumbercard top margin60
cardLeftMarginnumbercard left margin20

Exemple Usage

render () {
    <View style={styles.container}>
        <Swiper
            cards={['DO', 'MORE', 'OF', 'WHAT', 'MAKES', 'YOU', 'HAPPY']}
            renderCard={(card) => {
                return (
                    <View style={styles.card}>
                        <Text style={styles.text}>{card}</Text>
                    </View>
                )
            }}
            onSwiped={(cardIndex) => {console.log(cardIndex)}}
            onSwipedAll={() => {console.log('onSwipedAll')}}
            cardIndex={0}
            backgroundColor={'#4FD0E9'}
        />
    </View>
}

Stylesheet exemple


const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF'
  },
  card: {
    flex: 1,
    alignSelf: 'stretch',
    borderRadius: 4,
    borderWidth: 2,
    borderColor: '#E8E8E8',
    justifyContent: 'center',
    backgroundColor: 'white',
  },
  text: {
    textAlign: 'center',
    fontSize: 50,
    backgroundColor: 'transparent'
  }
})

Todo

Add an opacity animation

Keywords

FAQs

Package last updated on 08 Apr 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc