1

In my React Native (ver 0.23.0) project (Android + iOS) I want to use pull to refresh gesture to refresh the ListView.

This is my code:

<RefreshControl
  style={styles.container}
  refreshing={this.state.isRefreshing}
  onRefresh={this.onRefreshList} >
  <ListView
    onEndReachedThreshold={500}
    onEndReached={this.onEndReached}
    dataSource={this.state.dataSource}
    renderRow={this.renderItem}
    pageSize={Const.defaultPerPage}
    scrollRenderAheadDistance={500}
    style={styles.container}
    renderFooter={this.renderFooter}
  />
</RefreshControl>

It is working well on android but on ios I am getting this error:

enter image description here

I have no idea what is wrong, because I am not iOS developer. Does anybody have? Or does anybody know any good alternative npm package to use for pull to refresh ListView for both platforms?

Thanks for any help!

matusalem
  • 2,461
  • 2
  • 26
  • 35

1 Answers1

1

As per documentation, RefreshControl should be passed to the ListView as a prop, instead of wrapping the ListView in one:

<ListView
  refreshControl={
    <RefreshControl
      refreshing={this.state.refreshing}
      onRefresh={this._onRefresh.bind(this)}
    />
  }
/>
jevakallio
  • 35,324
  • 3
  • 105
  • 112
  • Can you take a look at [this](http://stackoverflow.com/questions/36472865/refreshcontrol-in-listview-does-not-work-for-some-unknown-reason). Any help will be much appreciated! – Mihir Apr 08 '16 at 05:55