Stop calling onEndReached unnecessarily

This commit is contained in:
Diego Mello 2022-12-06 18:45:10 -03:00
parent 7b526fe700
commit ae7398233a
1 changed files with 7 additions and 1 deletions

View File

@ -216,7 +216,13 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
}
}, 300);
onEndReached = () => this.query();
onEndReached = () => {
const { messages } = this.state;
if (messages.length < this.count) {
return;
}
this.query();
};
onRefresh = () =>
this.setState({ refreshing: true }, async () => {