alexbrillant / react-native-deck-swiper

tinder like react-native deck swiper
ISC License
1.56k stars 465 forks source link

Card renders previously swiped card, and then renders correct card #161

Open jonathanRinciari opened 6 years ago

jonathanRinciari commented 6 years ago

I have it currently set up in a redux project that removed the card that was just swiped, and than added a new card to the end of the array. However after swiping the deck renders and shows the previous card, than delays and than updates to the new card.

`<Swiper cards={cards} renderCard={(card, i) => { return ( <TouchableWithoutFeedback style={styles.card} onPress={() => onPress(card, i)}>

{card.streetNumber} {card.street} {card.streetType} ${card.price}, {card.sqft} sqft
      </TouchableWithoutFeedback>
    )
  }}
  onSwipedLeft={(cardIndex) => onSwipeLeft(cards[cardIndex], cardIndex)}
  onSwipedRight={(cardIndex) => onSwipeRight(cards[cardIndex], cardIndex)}
  onSwipedAll={() => console.log(cards, 'here!')}
  backgroundColor={'transparent'}
  cardIndex={0}
  stackSize={3}
  cardStyle={styles.cardStylePortrait}

/> `

TusharAswal commented 6 years ago

Any solutions??

TusharAswal commented 6 years ago

can u try using goBackToPreviousCardOnSwipeBottom={true} instead of goBackToPreviousCardOnSwipeTop={true}