React-native-swipe-list-view: Open row on press

Created on 24 Jul 2017  路  3Comments  路  Source: jemise111/react-native-swipe-list-view

Hi, is there a way to manually open a row by an onPress?

Most helpful comment

Hey @kyangy, this behavior isn't currently technically supported but there is some hackery you could do in meantime:

class Example {

  openRow = (rowRef) => {
    // Use an internal method to manually swipe the row open to whatever value you pass
    rowRef.manuallySwipeRow(50);
  }

  render() {
    <SwipeListView
       renderRow={ (data, secId, rowId, rowMap) => (
      <TouchableHighlight
             onPress={ _ => this.openRow(rowMap[`${secId}${rowId}`])}
          />
       }
    />
  }

}

Hope that helps!

(sorry for the delay in responding!)

All 3 comments

Hey @kyangy, this behavior isn't currently technically supported but there is some hackery you could do in meantime:

class Example {

  openRow = (rowRef) => {
    // Use an internal method to manually swipe the row open to whatever value you pass
    rowRef.manuallySwipeRow(50);
  }

  render() {
    <SwipeListView
       renderRow={ (data, secId, rowId, rowMap) => (
      <TouchableHighlight
             onPress={ _ => this.openRow(rowMap[`${secId}${rowId}`])}
          />
       }
    />
  }

}

Hope that helps!

(sorry for the delay in responding!)

Closing as this seems to be sufficient for most people

Hello and thanks for your answer. Can you explain a little bit how and where to create this function?

Was this page helpful?
0 / 5 - 0 ratings