react-native-card-stack-swiper
react-native-card-stack-swiper copied to clipboard
Mapping in Card
Hi, I'm trying to map custom index on "CARD" of card stack swiper using map function. But when i try to onSwipedLeft in CARD its not working even console.log so i cant get my custom index outside of CARD. Can anyone help me in this
Here's my code
` <CardStack
style={styles.content}
renderNoMoreCards={() => (
<Text style={styles.MatchLabel}>No more cards :(</Text>
)}
onSwipedRight={index => console.log('right', index)} //like(index)}
onSwipedLeft={() => console.log('left')} //</View>dislike(index)}
onSwipedTop={() => console.log('top')} //superLike(index)}
ref={swiperRef}>
{match.map((data, {index = data.user_id}) => (
<Card
style={styles.card}
key={index}
onSwipedLeft={() => {
console.log('Swiped LEFt');
}}>
<TouchableOpacity
onPress={() => {
setShowModal(true);
setName(data.name);
setAge(data.age);
setGender(data.gender);
setImage(data.image);
setZodiac(data.zodiac);
setAbout(data.intro);
setPrefGender(data.preferred_gender);
setAuthor(data.fav_author);
setPrefMinAge(data.preferred_age_min);
setPrefMaxAge(data.preferred_age_max);
}}>
<ImageBackground
source={
data.image === null
? require('../assets/images/Profile.jpeg')
: {uri: `data:image/jpeg;base64,${data.image}`}
}
style={{height: '100%', width: '100%'}}>
<Text style={styles.label}>{data.name}</Text>
</ImageBackground>
</TouchableOpacity>
</Card>
))}
</CardStack>`