swaplet / react-native-swipe-cards-deck

A swipping cards deck (similar to Tinder)
MIT License
46 stars 19 forks source link

How to program button to swipeYup card? #25

Closed hristowwe closed 2 years ago

hristowwe commented 2 years ago

Hello, i want to program my own button in card component view and when i press it to remove card? How can i do that? I think i should use swipeYup function? I tried with

  function Card({ data }) {
    return (
      <View style={[styles.card, { backgroundColor: data.backgroundColor }]}>
        <Text>{data.text}</Text>
        <Button title="dsfsdf" onPress={() => handleYup(data)} />
      </View>
    );
  }
  function handleYup(card) {
    console.log(`Yup for ${card.text}`);
    return true; // return false if you wish to cancel the action
  }

Not work at all ! Where i should use swipeYup or swipeNope

hristowwe commented 2 years ago

Found solution i should create ref and use in button sheetRef.current.swipeYup() or sheetRef.current.swipeNope()