Open cnlkkrb opened 10 months ago
When I swipeBack, it brings back the last card I swiped, but the previous card disappears for 0.5 seconds and comes back. Is there a solution to this? I think the swipeBack command is working incorrectly. Can you solve this?
const backButton = () => { const newIndex = (currentIndex - 1 + cards.length) % cards.length; setCurrentIndex(newIndex); dotAnimation.setValue(newIndex); swiperRef.current?.swipeBack(); //swiperRef.current?.jumpToCardIndex(newIndex); };
return ( <SafeAreaView style={{ flex: 1, backgroundColor: 'white' }}> <Swiper ref={swiperRef} cards={cards} containerStyle={styles.swiperContainer} renderCard={(card) => { return (
); }} onSwipedRight={(cardIndex) => { setCurrentIndex(cardIndex + 1); dotAnimation.setValue(cardIndex); if (cardIndex == cards.length - 1) { nextCard() } }} onSwipedLeft={(cardIndex) => { setCurrentIndex(cardIndex + 1); dotAnimation.setValue(cardIndex + 1); if (cardIndex === cards.length - 1) { nextCard(); } }} cardStyle={{ width: '90%', height: '100%', flex: 1 }} cardIndex={currentIndex} stackSize={4} overlayLabels={OverlayLabels} animateOverlayLabelsOpacity={true} disableBottomSwipe={true} disableTopSwipe={true} infinite={false} verticalSwipe={false} stackScale={0} secondCardZoom={0} stackSeparation={0} marginTop={0} swipeBackCard={true} >
When I swipeBack, it brings back the last card I swiped, but the previous card disappears for 0.5 seconds and comes back. Is there a solution to this? I think the swipeBack command is working incorrectly. Can you solve this?
const backButton = () => { const newIndex = (currentIndex - 1 + cards.length) % cards.length; setCurrentIndex(newIndex); dotAnimation.setValue(newIndex); swiperRef.current?.swipeBack(); //swiperRef.current?.jumpToCardIndex(newIndex); };
return ( <SafeAreaView style={{ flex: 1, backgroundColor: 'white' }}> <Swiper ref={swiperRef} cards={cards} containerStyle={styles.swiperContainer} renderCard={(card) => { return (