deanmcpherson / react-native-sortable-listview

Drag drop capable wrapper of ListView for React Native
MIT License
917 stars 235 forks source link

Access row's index from inside row component #47

Closed logileifs closed 7 years ago

logileifs commented 7 years ago

How would one access the index of a row from inside a RowComponent instance?

For example, if I were to add a button to my row and one that button is pressed I would like to know where in the order array the pressed row is.

How would one accomplish that?

deanmcpherson commented 7 years ago

Hi @logileifs, in the renderRow function, I believe the third argument is the row's index.

ippa commented 7 years ago

Nice, but if I display that number inside the RowComponent it's not updated when I reorder the rows? Basically I wan't to display #1, #2, #3, etc.. in each RowComponent

chetstone commented 7 years ago

@ippa I'm also finding that the index is not updated when the rows are reordered, so I just define

rowHasChanged={(r1,r2) => {return true}}

I have a short list, so it should be OK.

chetstone commented 7 years ago

Closing, inactive.