Disable bottom swipe just for first card
isaacshalom1 opened this issue · comments
I want my user to be able to go backward on the cards, but is there a way to disable bottom swipe just for the first card? if the user swipes down on the first card as of now nothing would appear on the screen
Yes, save the swipe index on the state, so the initial is 0.
And the swiper has a prop called disableBottomSwipe
along with other props for disabling each direction.
So you can write:
//the state:
const [cardIndex,setCardIndex] = useState(0)
//the Swiper
<Swiper onSwiped = {()=>setCardIndex(cardIndex+1)} disableBottomSwipe={cardIndex === 0} //rest of the props />