1

I am trying to install shoutem ui to my project. In one component I used listview from shoutem ui! But I only can display item. I can't handler onRefresh and onLoadMore?

Can anyone help me?

Here is listview:

<ListView
          data={groupedData}
          renderRow={this.renderRow}
          loading={this.state.refreshing}
          onLoadMore ={this.loadMoreData}
          onRefresh={this.getNewData}
        />

I have 2 functions for getnew, data and loadmore. They can work with normal listview.

Martin Evans
  • 45,791
  • 17
  • 81
  • 97
Chu Việt Hưng
  • 141
  • 1
  • 1
  • 8

1 Answers1

0

I am not sure what is the problem here exactly. It would be useful if you could include the code of your entire screen.

The onRefresh callback will be called when the user performs a pull down to refresh action on the list view. onLoadMore will be called when the user scrolls to the end of the list. Both of those functions should be used to fetch the data, but the list will only display the data that it receives through the data prop.

If the problem is with the spinner remaining visible after the data has been fetched, you can control the visibility of the spinner through the loading prop of the ListView. The spinner will remain visible until you reset the loading prop.

So the flow should be as follows:

  1. Trigger a network request in onRefresh/onLoadMore
  2. When the data is fetched from the server
    • render the list by passing it the new data through the data prop
    • reset the loading prop to false after the network request has finished or failed