Allow for disableBottomSwipe (and others) to be functions
See original GitHub issueIt would be useful to allow for disableBottomSwipe and the other similar props to be booleans or functions that return a boolean, to allow clients to enable or disable swipe directions per-card.
It might look something like:
<Swiper
cards={ [ /* ... */ ] }
disableTopSwipe={
card => card.canSwipeUp
} />
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:7 (3 by maintainers)
Top Results From Across the Web
react-native-deck-swiper/README.md at master - GitHub
Swipe animation props ; swipeAnimationDuration, number, duration of the swipe animation ; disableBottomSwipe, bool, disable bottom swipe ; disableLeftSwipe, bool ...
Read more >How to Get data from react native-deck-swiper when swiped
I have written a function that opens a web browser. PLEASE CAN SOMEONE HELP ME. //SWIPPER <SafeAreaView style={{ flex: 1 }}> {/* < ......
Read more >starodubenko/react-native-card-stack-swiper - npm package
disableBottomSwipe, bool, disable bottom swipe, false ... onSwipeStart, func, function to be called when a card swipe starts.
Read more >Tinder like React Native Card Stack Swiper - Morioh
React Native allows developers to develop mobile apps that have compatibility with Android, iOS & other operating systems. Due to the features like ......
Read more >[Solved]-How to pass dynamic ref in react-native-deck-swiper ...
function MySwiper({item}) { const swiperRef = useRef(null); const [isSwipedAll, ... API_URL_DEV}/copernic/vote/add`, requestOptions ); let json = await ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
How does your state management look like? Unless your cardIndex changes, it will always be 0 for instance. So no matter how many times you swipe, cards[cardIndex].bottomDisabled will be cards[0].bottomDisabled, which is disabled. As you swipe the swiper keeps track of your index internally and renders the proper cards, but since cardIndex isn’t updated within the parent component, it will stay to what you initialise the state with (probably 0), resulting in your error.
PS: didn’t put all props for the Swiper. bottomDisabled is a bool prop within the card object part of the cards array passed onto the Swiper… If it’s missing it automatically goes to false.