static propTypes = {
scrollKey: PropTypes.string.isRequired,
- onScrollToBottom: PropTypes.func,
+ onLoadMore: PropTypes.func.isRequired,
onScrollToTop: PropTypes.func,
onScroll: PropTypes.func,
trackScroll: PropTypes.bool,
const offset = scrollHeight - scrollTop - clientHeight;
this._oldScrollPosition = scrollHeight - scrollTop;
- if (400 > offset && this.props.onScrollToBottom && !this.props.isLoading) {
- this.props.onScrollToBottom();
- } else if (scrollTop < 100 && this.props.onScrollToTop) {
+ if (400 > offset && this.props.onLoadMore && !this.props.isLoading) {
+ this.props.onLoadMore();
+ }
+
+ if (scrollTop < 100 && this.props.onScrollToTop) {
this.props.onScrollToTop();
} else if (this.props.onScroll) {
this.props.onScroll();
handleLoadMore = (e) => {
e.preventDefault();
- this.props.onScrollToBottom();
+ this.props.onLoadMore();
}
_recentlyMoved () {
scrollKey: PropTypes.string.isRequired,
statusIds: ImmutablePropTypes.list.isRequired,
featuredStatusIds: ImmutablePropTypes.list,
- onScrollToBottom: PropTypes.func,
+ onLoadMore: PropTypes.func,
onScrollToTop: PropTypes.func,
onScroll: PropTypes.func,
trackScroll: PropTypes.bool,
}
}
- handleScrollToBottom = () => {
+ handleLoadMore = () => {
if (!this.props.isLoading && this.props.hasMore) {
this.props.dispatch(expandAccountTimeline(this.props.params.accountId, this.props.withReplies));
}
featuredStatusIds={featuredStatusIds}
isLoading={isLoading}
hasMore={hasMore}
- onScrollToBottom={this.handleScrollToBottom}
+ onLoadMore={this.handleLoadMore}
/>
</Column>
);
this.column = c;
}
- handleScrollToBottom = debounce(() => {
+ handleLoadMore = debounce(() => {
this.props.dispatch(expandFavouritedStatuses());
}, 300, { leading: true })
scrollKey={`favourited_statuses-${columnId}`}
hasMore={hasMore}
isLoading={isLoading}
- onScrollToBottom={this.handleScrollToBottom}
+ onLoadMore={this.handleLoadMore}
/>
</Column>
);
};
componentWillUnmount () {
- this.handleScrollToBottom.cancel();
+ this.handleLoadMore.cancel();
this.handleScrollToTop.cancel();
this.handleScroll.cancel();
this.props.dispatch(scrollTopNotifications(false));
}
- handleScrollToBottom = debounce(() => {
- this.props.dispatch(scrollTopNotifications(false));
+ handleLoadMore = debounce(() => {
this.props.dispatch(expandNotifications());
}, 300, { leading: true });
isLoading={isLoading}
hasMore={hasMore}
emptyMessage={emptyMessage}
- onScrollToBottom={this.handleScrollToBottom}
+ onLoadMore={this.handleLoadMore}
onScrollToTop={this.handleScrollToTop}
onScroll={this.handleScroll}
shouldUpdateScroll={shouldUpdateScroll}
const mapDispatchToProps = (dispatch, { timelineId, loadMore }) => ({
- onScrollToBottom: debounce(() => {
- dispatch(scrollTopTimeline(timelineId, false));
- loadMore();
- }, 300, { leading: true }),
+ onLoadMore: debounce(loadMore, 300, { leading: true }),
onScrollToTop: debounce(() => {
dispatch(scrollTopTimeline(timelineId, true));