webraptor / react-native-deck-swiper

tinder like react-native deck swiper
ISC License
126 stars 81 forks source link

Multiple cards gets released on a single swipe #37

Open diivyu opened 3 years ago

diivyu commented 3 years ago

I have a stack size of 2, while swiping the card left/right, 2 cards get release from the list. Like I have a list of 10 cards whose id are as 1,2,3,4...10. Now when I am showing them 2 cards gets displayed (id =>1,2) now when i am swiping the card the next cards that should be shown will be of(id => 2,3), but what's happening is.... That it trashes both the cards simultaneously and shows new cards having (id => 3,4). How I can manage this ? Please suggest. I am attaching my code below.

<Swiper
    cards={userListingData}
    renderCard={(card, index) => this.renderCard(card, index)}
    keyExtractor={(card, index) => card.userID.toString()}
    disableTopSwipe={true}
    disableBottomSwipe={true}
    onSwipedLeft={(index,card) => this.onSwiped('left',index,card)}
    onSwipedRight={(index,card) => this.onSwiped('right',index,card)}
    cardIndex={this.state.cardIndex}
    animateOverlayLabelsOpacity={false}
    animateCardOpacity={false}
    backgroundColor={COLORS.WHITE}
    cardHorizontalMargin={22}
    cardVerticalMargin={0}
    useViewOverflow={Platform.OS === 'ios'}
    ref={(swiper) => { this.swiper = swiper }}
    stackSize={2}
    swipeBack
    showSecondCard={true}
    stackSeparation={0}
    stackScale={0}
    swipeBackCard={false}
  />
webraptor commented 3 years ago

cardIndex={this.state.cardIndex}

By any chance do you update the cardIndex outside of the swiper component? As in incrementing it when a swipe occurs?

diivyu commented 3 years ago

cardIndex={this.state.cardIndex}

By any chance do you update the cardIndex outside of the swiper component? As in incrementing it when a swipe occurs?

No.

webraptor commented 3 years ago

@diivyu did you manage to fix this?

diivyu commented 3 years ago

@diivyu did you manage to fix this?

No.

mirza-osv commented 3 years ago

I'm also facing the same issue.. This seems to be bug in this module