computerjazz/react-native-swipeable-item

Function trigger with overswipe

Closed this issue · 2 comments

Hi,

first of all, your package is awesome, but i have a question. Is there any option, for example to trigger a deletefunction with overswipe. I use the draggable flatlist and i need full swipe delete and delete to tap.

Thank for answer.
Regards, Daniel

You can set a snap point at the point you want to trigger delete and then listen for that point in onChange.
Here's a quick and dirty example:

<SwipeableItem
  item={props.item}
  snapPointsRight={[0, 100, Dimensions.get("window").width]}
  onChange={({ snapPoint }) => {
    if (snapPoint === Dimensions.get("window").width) {
      alert("delete!");
    }
  }}
  renderUnderlayRight={() => <View />}
  renderOverlay={() => <RowItem {...props} />}
/>

swipe-to-del

@computerjazz I think this should be documented. I was searching for this solution. Great library man! 🎉