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

Button works but cards doesnt changed #141

Open
mustafaefdal1 opened this issue Feb 9, 2023 · 1 comment
Open

Button works but cards doesnt changed #141

mustafaefdal1 opened this issue Feb 9, 2023 · 1 comment

Comments

@mustafaefdal1
Copy link

mustafaefdal1 commented Feb 9, 2023

first of all thanks for this library,

I am making a survey application with react native. I get the questions from the database with their answers, so my buttons are in the card.

#86 (comment)

When I made the changes written in this comment, the buttons started working. However, although the buttons work, the card does not change. I can transfer the answers of the two questions to the database, but the card does not change in the application.

How can I resolve this situation?

this is my code;

<View style={styles.container}>
      <View style={styles.cardContainer}>
        {surveyQuestions.map((item, key) => (
          <TinderCard
            preventSwipe={['up', 'down']}
            className={'pressable'}
            key={item.id}
            onSwipe={dir => swiped(dir, item.SurveyQuestionOptions, item.id)}>
            <View style={styles.card}>
              <Text style={styles.text}>{item.question}</Text>
              <View
                style={{
                  justifyContent: 'space-around',
                  flexDirection: 'row',
                  paddingTop: 50,
                }}>
                <Button
                  style={styles.buttonStyle}
                  onPress={() =>
                    swiped('left', item.SurveyQuestionOptions, item.id)
                  }
                  color={'black'}>
                  <Text style={styles.buttonText}>
                    {item.SurveyQuestionOptions[1].options}
                  </Text>
                </Button>
                <Button
                  style={styles.buttonStyle}
                  onPress={() =>
                    swiped('right', item.SurveyQuestionOptions, item.id)
                  }
                  color={'black'}>
                  <Text style={styles.buttonText}>
                    {item.SurveyQuestionOptions[0].options}
                  </Text>
                </Button>
              </View>
            </View>
          </TinderCard>
        ))}
      </View>
    </View>

this is my style codes;

const styles = StyleSheet.create({
  container: {
    backgroundColor: '#C91623',
    alignContent: 'center',
    flexDirection: 'column',
    flex: 1,
    alignItems: 'center',
    justifyContent: 'center',
  },
  cardContainer: {
    width: '100%',
    maxWidth: 320,
    height: 300,
  },
  card: {
    width: 320,
    height: 300,
    borderRadius: 20,
    borderWidth: 2,
    justifyContent: 'center',
    alignItems: 'center',
    position: 'absolute',
    resizeMode: 'cover',
    fontSize: 25,
    color: 'white',
    backgroundColor: '#CDC0B9',
    flex: 1,
    marginBottom: 20,
    shadowColor: '#000',
    shadowOffset: {
      width: 0,
      height: 12,
    },
    shadowOpacity: 0.7,
    shadowRadius: 16.0,
    elevation: 24,
  },
  text: {
    textAlign: 'center',
    fontSize: 25,
    color: 'black',
    fontWeight: '600',
  },
  buttonText: {
    fontSize: 18,
    color: '#170C06',
    alignItems: 'center',
    fontWeight: '700',
    fontFamily: 'Courier',
    textAlign: 'center',
  },
  buttonStyle: {
    width: 100,
    height: 50,
    margin: 5,
    borderWidth: 2,
    borderRadius: 50,
    textAlign: 'center',
    alignSelf: 'center',
    backgroundColor: '#CDC0B9',
  },
});
@TeerthTejani26
Copy link

hi, can i work on this issue?

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