Closed lukewlms closed 7 years ago
@lukecwilliams
like this ?
left = [{
text: 'More',
onPress() { console.log('more press') },
}]
that looks like it will work if we don't need to use this
.
I think the more general solution is to extract the item into its own component, so that it can just render with its props. Thanks for the response!
All examples I've seen for implementing
onPress
on a swipeout button involve creating an arrow function inside of render().For example, from this blog post (Aug 2017) defines
swipeSettings
inside ofrenderItem
.As far as I know, arrow functions are discouraged inside of
render()
because of performance - a new function instance is created on every render.Can we use this library without also creating arrow functions inside of
render()
? So far I don't see another way for onPress to know what data it's for. (It seems natural that it would take a sectionId and rowId as onOpen do, but somehow it does not.)