Skip to content

Added extra onPress is always invoked #29

@thomasdittmar

Description

@thomasdittmar

First of all everything works as expected. Hence, this is not really a bug report.

In my instance I use react-native-swipeable-item together with react-native-draggable-flatlist but the Row would have an additional TouchableOpacity something like that

<SwipeableItem
  key={item.key}
   ...
  snapPointsLeft={[150]}
  snapPointsRight={[175]}>
  <View
    style={[styles.row, { backgroundColor: item.backgroundColor, height: item.height }]}>
    {/* this is the drag handler for reordering */}
    <TouchableOpacity onLongPress={drag}>
      <Text style={styles.text}>...</Text>
    </TouchableOpacity>
    {/* this is the clickable main row that will open an edit modal to edit the row data*/}
    <TouchableOpacity onPress={() => {
      console.log('row pressed')
      openModal()
    }>
      <Text style={styles.text}>The main row</Text>
    </TouchableOpacity>
  </View>
</SwipeableItem>

The setup is like the Google mail app, only that one can't reorder the items. In the Google mail app one can swipe left or right or click on the row to see the content of the mail.

I would like the same outcome but once I begin to swipe the onPress of the main row gets invoked before the onChange event. It would look like that if I log out the value of the onChange event.

LOG      row pressed
LOG      left
LOG      left
LOG      right
LOG      0

Is there a way to accomplish this? SwipeableItem would need an extra event that get's invoked as soon as the swipe starts so the onPress of 2nd TouchableOpacity can be disabled, right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions