Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable bottom swipe just for first card #376

Open
isaacshalom1 opened this issue Dec 16, 2021 · 1 comment
Open

Disable bottom swipe just for first card #376

isaacshalom1 opened this issue Dec 16, 2021 · 1 comment

Comments

@isaacshalom1
Copy link

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

@FatjonRrapaj
Copy link

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 />

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants