If you are using the standalone
could you please give the example for the above sentence.
this is how I am using now (Pseudo code).
RenderItem=>
<SwipeRow ref={(SwipeRow) => { this.refSwipeRow = SwipeRow; }} >
<TouchableOpacity onPress={this.refSwipeRow.closeRow()}>
<Text> Hello </Text>
</TouchableOpacity>
Hey @sandeep-t2s this is because as each row is rendered you are setting this.refSwipeRow to the newly rendered row. Therefore each new row over writes the previous one and you only keep a reference to the last rendered row.
In order to close a specific row you'll have to keep track of the ref to each SwipeRow, likely in an object.
For example let's say you just have a list of data, and each item has its own id. You could do something like this:
constructor() {
this.rows = {};
}
...
renderItem={({item}) => {
<SwipeRow
ref={ref => { this.rows[item.id] = ref }}
>
<TouchableHighlight onPress={() => this.rows[item.id].closeRow()} />
</SwipeRow>
}
Hope that helps! Going to close this as I do not believe it is an issue with the library itself. Please let me know and re-open if you're still having problems, thanks!
Most helpful comment
Hey @sandeep-t2s this is because as each row is rendered you are setting
this.refSwipeRowto the newly rendered row. Therefore each new row over writes the previous one and you only keep a reference to the last rendered row.In order to close a specific row you'll have to keep track of the ref to each SwipeRow, likely in an object.
For example let's say you just have a list of data, and each item has its own id. You could do something like this:
Hope that helps! Going to close this as I do not believe it is an issue with the library itself. Please let me know and re-open if you're still having problems, thanks!