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

react-native-swipable-cards

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-swipable-cards - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

2

package.json
{
"name": "react-native-swipable-cards",
"version": "0.0.2",
"version": "0.0.3",
"description": "Swipable cards with different behaviors",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -134,3 +134,3 @@ import React, { Component } from 'react'

renderFirstCard(card) {
renderFirstCard(card, cardIndex) {
const { pan, enter } = this.state

@@ -152,3 +152,3 @@

<Animated.View
key={+new Date() + Math.random()}
key={cardIndex}
style={[this.props.cardStyle, animatedCardstyles ]}

@@ -162,6 +162,6 @@ {...this._panResponder.panHandlers}

renderStackCard(card, style) {
renderStackCard(card, style, cardIndex) {
return (
<Animated.View
key={+new Date() + Math.random()}
key={cardIndex}
style={[this.props.cardStyle, style]}

@@ -175,8 +175,12 @@ >

renderStack() {
let { currentCardIdx } = this.state
let cards = this.props.cards.slice(currentCardIdx, currentCardIdx + this.props.stackDepth).reverse()
const { currentCardIdx } = this.state
const { cards, stackDepth } = this.props
return cards.map((card, i) => {
if (i + 1 === cards.length) {
return this.renderFirstCard(card)
return Array(stackDepth).fill().map((_, i) => {
// Render last card first
const cardIndex = currentCardIdx + (stackDepth - 1) - i
const card = cards[cardIndex]
if (cardIndex === currentCardIdx) {
return card && this.renderFirstCard(card, cardIndex)
}

@@ -197,3 +201,3 @@

return this.renderStackCard(card, style)
return card && this.renderStackCard(card, style, cardIndex)
})

@@ -215,5 +219,3 @@ }

<View style={this.props.containerStyle}>
{ this.state.card
? (this.props.stack ? this.renderStack() : this.renderFirstCard(this.state.card))
: this.renderNoMoreCards() }
{ this.state.card ? this.renderStack() : this.renderNoMoreCards() }

@@ -261,3 +263,2 @@ { this.props.renderNope

alignItems: 'center',
backgroundColor: '#F5FCFF'
},

@@ -264,0 +265,0 @@ yup: {

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