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