|
|
@ -1,5 +1,5 @@
|
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import React, { PureComponent } from 'react';
|
|
|
|
import { ScrollContainer } from 'react-router-scroll-4';
|
|
|
|
import ScrollContainer from 'flavours/glitch/containers/scroll_container';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import IntersectionObserverArticleContainer from 'flavours/glitch/containers/intersection_observer_article_container';
|
|
|
|
import IntersectionObserverArticleContainer from 'flavours/glitch/containers/intersection_observer_article_container';
|
|
|
|
import LoadMore from './load_more';
|
|
|
|
import LoadMore from './load_more';
|
|
|
@ -34,7 +34,6 @@ class ScrollableList extends PureComponent {
|
|
|
|
onScrollToTop: PropTypes.func,
|
|
|
|
onScrollToTop: PropTypes.func,
|
|
|
|
onScroll: PropTypes.func,
|
|
|
|
onScroll: PropTypes.func,
|
|
|
|
trackScroll: PropTypes.bool,
|
|
|
|
trackScroll: PropTypes.bool,
|
|
|
|
shouldUpdateScroll: PropTypes.func,
|
|
|
|
|
|
|
|
isLoading: PropTypes.bool,
|
|
|
|
isLoading: PropTypes.bool,
|
|
|
|
showLoading: PropTypes.bool,
|
|
|
|
showLoading: PropTypes.bool,
|
|
|
|
hasMore: PropTypes.bool,
|
|
|
|
hasMore: PropTypes.bool,
|
|
|
@ -264,10 +263,6 @@ class ScrollableList extends PureComponent {
|
|
|
|
this.props.onLoadMore();
|
|
|
|
this.props.onLoadMore();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
defaultShouldUpdateScroll = (prevRouterProps, { location }) => {
|
|
|
|
|
|
|
|
return !(prevRouterProps?.location?.state?.mastodonModalKey || location.state?.mastodonModalKey);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleLoadPending = e => {
|
|
|
|
handleLoadPending = e => {
|
|
|
|
e.preventDefault();
|
|
|
|
e.preventDefault();
|
|
|
|
this.props.onLoadPending();
|
|
|
|
this.props.onLoadPending();
|
|
|
@ -281,7 +276,7 @@ class ScrollableList extends PureComponent {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
render () {
|
|
|
|
render () {
|
|
|
|
const { children, scrollKey, trackScroll, shouldUpdateScroll, showLoading, isLoading, hasMore, numPending, prepend, alwaysPrepend, append, emptyMessage, onLoadMore } = this.props;
|
|
|
|
const { children, scrollKey, trackScroll, showLoading, isLoading, hasMore, numPending, prepend, alwaysPrepend, append, emptyMessage, onLoadMore } = this.props;
|
|
|
|
const { fullscreen } = this.state;
|
|
|
|
const { fullscreen } = this.state;
|
|
|
|
const childrenCount = React.Children.count(children);
|
|
|
|
const childrenCount = React.Children.count(children);
|
|
|
|
|
|
|
|
|
|
|
@ -347,7 +342,7 @@ class ScrollableList extends PureComponent {
|
|
|
|
|
|
|
|
|
|
|
|
if (trackScroll) {
|
|
|
|
if (trackScroll) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<ScrollContainer scrollKey={scrollKey} shouldUpdateScroll={shouldUpdateScroll || this.defaultShouldUpdateScroll}>
|
|
|
|
<ScrollContainer scrollKey={scrollKey}>
|
|
|
|
{scrollableArea}
|
|
|
|
{scrollableArea}
|
|
|
|
</ScrollContainer>
|
|
|
|
</ScrollContainer>
|
|
|
|
);
|
|
|
|
);
|
|
|
|