If I do something like this, my onPress method gets call for every rows at render.
renderHiddenRow={(rowData, secId, rowID) => (
<TouchableHighlight onPress={this._handleRemoveIdea(rowID)} style={styles.rowBack}>
<Text style={styles.rowBackText}>Delete</Text>
</TouchableHighlight>
)}
I think this is because you're actually calling the function when the onPress handler is bound to the TouchableHighlight. Could you give something like this a try:
<TouchableHighlight onPress={ _ => this._handleRemoveIdea(rowID) } style={styles.rowBack}>
Let me know if that does the trick otherwise I'll investigate further
Thanks, I will try that tonight and will let you know
It works great. thanks
@jemise111 your solution works great :) Thanks a lot
@jemise111 Thanks a lot for your solution and its explanation.
@jemise111 It works, thanks a lot. :)
Most helpful comment
I think this is because you're actually calling the function when the onPress handler is bound to the TouchableHighlight. Could you give something like this a try:
<TouchableHighlight onPress={ _ => this._handleRemoveIdea(rowID) } style={styles.rowBack}>Let me know if that does the trick otherwise I'll investigate further