Added pull to refresh capability to StatusList, ScrollableList for HomeTimeline to start

• Added:
- pull to refresh capability to StatusList, ScrollableList for HomeTimeline to start

• Updated:
- PullToRefresher styles

• Todo:
- Will add to additional timelines soon
This commit is contained in:
mgabdev
2020-06-05 21:45:58 -04:00
parent 91a227913a
commit 67824bb5e1
4 changed files with 30 additions and 11 deletions

View File

@@ -31,6 +31,7 @@ export default class ScrollableList extends PureComponent {
}
state = {
pullToRefreshTriggered: false,
cachedMediaWidth: 250, // Default media/card width using default Gab Social theme
}
@@ -126,8 +127,11 @@ export default class ScrollableList extends PureComponent {
const { innerHeight } = this.window;
const offset = scrollHeight - scrollTop - innerHeight;
if (scrollTop < -60 && this.props.onReload) {
// reload
if (scrollTop < -80 && this.props.onReload && !this.state.pullToRefreshTriggered) {
this.setState({ pullToRefreshTriggered: true })
} else if (scrollTop > -10 && this.props.onReload && this.state.pullToRefreshTriggered) {
this.props.onReload()
this.setState({ pullToRefreshTriggered: false })
}
if (600 > offset && this.props.onLoadMore && this.props.hasMore && !this.props.isLoading) {