RenderRow metric from each row in react native

I am trying to get the current renderRow index, but I don't seem to understand it. I have also tried adding myself as a variable inside renderRow. I am doing a highscore and it would be super handy if I could just get the number from renderRow. If there is another way to get the current number every time, then it will work as well.

          <ListView
          dataSource={this.state.dataSource}
          renderRow={(rowData, rowID ) =>
          <Text style={styles.topStyle}>{rowID}</Text>
          }
      />

      

+3


source to share


1 answer


The callback renderRow

expects a function with 4 arguments renderRow={(rowData, sectionID, rowID, higlightRow) => { ... }}

. I believe this rowId

is the one you need.



Docs - http://facebook.github.io/react-native/docs/listview.html#renderrow

+5


source







All Articles