deanmcpherson / react-native-sortable-listview

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

Cannot read property 'props' of undefined #159

Closed JeremyBradshaw7 closed 5 years ago

JeremyBradshaw7 commented 5 years ago

Getting this error thrown on passing what looks to me like a valid data and order props.

TypeError: Cannot read property 'props' of undefined

This error is located at:
    in Row (at index.js:418)
    in StaticRenderer (at ListView.js:471)
    in RCTScrollContentView (at ScrollView.js:791)
    ...

It doesn't seem to matter if I supply a rowHasChanged function prop or not.

JeremyBradshaw7 commented 5 years ago

Found a workaround, problem was introduced by trying to call a render function passed in as props like this:

  renderRow={(data) => {
    if (this.props.renderItem) {
      this.props.renderItem(data);
    }
  }}

It seems this is undefined here?. If I call it more simply like this it works:

renderRow={this.props.renderItem}