New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.1K
increased by9.98%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-deck-swiper

contributions welcome Standard - JavaScript Style Guide npm version

Installation

npm install react-native-deck-swiper --save

Preview

App preview

Props

Card 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

Animation props

Propstypedescriptionrequired or default
verticalThresholdnumbervertical swipe thresholdheight / 5
horizontalThresholdnumberhorizontal swipe thresholdwidth / 4
secondCardZoomnumbersecond card zoom0.97
inputRotationRangearrayx values range for the rotation output[-width / 2, 0, width / 2]
outputRotationRangearrayrotation values for the x values in inputRotationRange["-10deg", "0deg", "10deg"]
animateOpacityboolanimate opacityfalse
inputOpacityRangeXarraypan x opacity input range[-width / 2, -width / 3, 0, width / 3, width / 2]
outputOpacityRangeXarrayopacity values for the values in inputOpacityRange[0.8, 1, 1, 1, 0.8]
inputOpacityRangeYarraypan y opacity input range[-height / 2, -height / 3, 0, height / 3, height / 2]
outputOpacityRangeYarrayopacity values for the values in inputOpacityRange[0.8, 1, 1, 1, 0.8]

Style props

Propstypedescriptionrequired or default
backgroundColornumberbackground color for the view containing the cards'#4FD0E9'
marginTopnumbermarginTop for the swiper container0
marginBottomnumbermarginBottom for the swiper container0
cardTopMarginnumbercard top margin60
cardLeftMarginnumbercard left margin20

Usage example

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 example


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(contributions are welcome)

Underlaying card offset to achieve a stack effect

Keywords

FAQs

Package last updated on 13 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