vendredi 28 mai 2021

How to make text of checkbox toggle as well

I have checkbox and text 'click me'. I did not use any external library for checkbox.

<TouchableOpacity
          onPress={onPress}
      >
        {isSelected && (
            <Icon
                color={Colors.darkPurple}
            />
        )}
      </TouchableOpacity>

And import this component into another one adding text (I mean title for checkbox)

        <View>
              <CheckBox
                style={styles.checkBox}
                touchableProps=
              />
              <Text>click me</Text>
            </View>

The issue is that the only checkbox icon is clickable. I need to make title of checkbox be clickable as well.

React Native.




Aucun commentaire:

Enregistrer un commentaire