Rendering images in a card causes flickering. React Native's Image component handles image caching like browsers for the most part. This causes flickering.
Make sure you set showSecondCard={false} for smoother and proper transitions while going back to previous card.
Props
type
description
default
goBackToPreviousCardOnSwipeLeft
bool
previous card is rendered on left swipe
false
goBackToPreviousCardOnSwipeRight
bool
previous card is rendered on right swipe
false
goBackToPreviousCardOnSwipeTop
bool
previous card is rendered on top swipe
false
goBackToPreviousCardOnSwipeBottom
bool
previous card is rendered on bottom swipe
false
Style props
Props
type
description
default
backgroundColor
number
background color for the view containing the cards
'#4FD0E9'
marginTop
number
marginTop for the swiper container
0
marginBottom
number
marginBottom for the swiper container
0
cardVerticalMargin
number
card vertical margin
60
cardHorizontalMargin
number
card horizontal margin
20
childrenOnTop
bool
render children on top or not
false
cardStyle
node
override swipable card style
{}
Methods
To trigger imperative animations, you can use a reference to the Swiper component.
Props
arguments
description
swipeLeft
mustDecrementCardIndex = false
swipe left to the next card
swipeRight
mustDecrementCardIndex = false
swipe right to the next card
swipeTop
mustDecrementCardIndex = false
swipe top to the next card
swipeBottom
mustDecrementCardIndex = false
swipe bottom to the next card
jumpToCardIndex
cardIndex
set the current card index
Usage example
render(){<Viewstyle={styles.container}><Swipercards={['DO','MORE','OF','WHAT','MAKES','YOU','HAPPY']}renderCard={(card)=>{return(<Viewstyle={styles.card}><Textstyle={styles.text}>{card}</Text></View>)}}onSwiped={(cardIndex)=>{console.log(cardIndex)}}onSwipedAll={()=>{console.log('onSwipedAll')}}cardIndex={0}backgroundColor={'#4FD0E9'}><ButtononPress={()=>{console.log('oulala')}}title="Press me">
You can press me
</Button></Swiper></View>}