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

Mapping in Card #97

Open
sidd2217 opened this issue May 13, 2022 · 0 comments
Open

Mapping in Card #97

sidd2217 opened this issue May 13, 2022 · 0 comments

Comments

@sidd2217
Copy link

sidd2217 commented May 13, 2022

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

1 participant