It's like the opposite of pull down to refresh. ListView on Android does not support bounces.
To achieve infinite scroll on ListView you can use onEndReached and renderFooter from ListView component. It could looks like this (you just renderFooter when onEndReached is triggered)
onEndReached() {
if (!this.state.waiting) {
this.setState({waiting: true});
this.fetchData() // fetching new data, ended with this.setState({waiting: false});
}
}
renderFooter() {
if (this.state.waiting) {
return <ActivityIndicator />;
} else {
return <Text>~</Text>;
}
}
render() {
return (
<ListView
dataSource={this.state.dataSource}
renderRow={this.renderRow}
renderFooter={this.renderFooter}
onEndReached={this.onEndReached}
/>);
}
Another way is to use some of libraries:
I tried with remobile, but it was deprecated (and too complicated, you have to implement about 4-5 method to satisfy this component). I used FaridSafi, it's ok but refresh is on click, not on pull.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With