react-native-gifted-listview
react-native-gifted-listview copied to clipboard
Is there a way to force a refresh?
Great control by the way, thank you!
I would like to reload the data in the list manually. I've found the _refresh() method, which works quite nicely when I use it with this.refs.listView._refresh().
However, is there any way to stop the view scrolling up, showing the spinner, and scrolling down again? Perhaps an option?
Hello @benvium, Maybe you can try
this.refs.listView._postRefresh(null, {external: true});
Thanks Farid. Sadly that doesn't seem to have any effect at all. I'll stick with the _refresh() option for now.
Hello guys, great library!
I just went through this situation, as mentioned by @benvium. In my case, I've tried a different approach, passing to the library a new prop called "shouldUpdate" (just to test), and testing this prop on "componentWillReceiveProps" lifecycle event. If this prop is true, I would run again onFetch.
componentWillReceiveProps(nextProps) {
if (nextProps.shouldUpdate) {
this.props.onFetch(this._getPage(), this._postRefresh, {firstLoad: false});
}
},
What do you think about this approach? I would love to discuss it with you guys in order to have this refreshing working.
My use case: I have this listview showing comments. Above these, I have a place to insert a new comment. After submitting a new comment, I would like to refresh my listview in order to show this new comment.
Appreciate your feedback on it! Thanks
@diegodurli It is worked for me but seems so slow to refresh. My use case: For searching.
I use the 'private' function from the library:
this.refs.listview._refresh();
My use case: For searching. It is worked very well.
@LaryIII Could you please show some examples on how you use it for searching?
doesn't work in my code , if there have another way? please , save my life @LaryIII @ @FaridSafi
Can anyone please provide an example to refresh the gifted listview?
@happy2share you can use FlatList in API , it can refresh & load more