|
|
@ -34,7 +34,7 @@ export default class ScrollableList extends PureComponent { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
state = { |
|
|
|
state = { |
|
|
|
lastMouseMove: null, |
|
|
|
fullscreen: null, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
intersectionObserverWrapper = new IntersectionObserverWrapper(); |
|
|
|
intersectionObserverWrapper = new IntersectionObserverWrapper(); |
|
|
@ -56,14 +56,6 @@ export default class ScrollableList extends PureComponent { |
|
|
|
trailing: true, |
|
|
|
trailing: true, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
handleMouseMove = throttle(() => { |
|
|
|
|
|
|
|
this._lastMouseMove = new Date(); |
|
|
|
|
|
|
|
}, 300); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleMouseLeave = () => { |
|
|
|
|
|
|
|
this._lastMouseMove = null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
componentDidMount () { |
|
|
|
componentDidMount () { |
|
|
|
this.attachScrollListener(); |
|
|
|
this.attachScrollListener(); |
|
|
|
this.attachIntersectionObserver(); |
|
|
|
this.attachIntersectionObserver(); |
|
|
@ -145,10 +137,6 @@ export default class ScrollableList extends PureComponent { |
|
|
|
this.props.onScrollToBottom(); |
|
|
|
this.props.onScrollToBottom(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_recentlyMoved () { |
|
|
|
|
|
|
|
return this._lastMouseMove !== null && ((new Date()) - this._lastMouseMove < 600); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
render () { |
|
|
|
const { children, scrollKey, trackScroll, shouldUpdateScroll, isLoading, hasMore, prepend, emptyMessage } = this.props; |
|
|
|
const { children, scrollKey, trackScroll, shouldUpdateScroll, isLoading, hasMore, prepend, emptyMessage } = this.props; |
|
|
|
const { fullscreen } = this.state; |
|
|
|
const { fullscreen } = this.state; |
|
|
@ -159,7 +147,7 @@ export default class ScrollableList extends PureComponent { |
|
|
|
|
|
|
|
|
|
|
|
if (isLoading || childrenCount > 0 || !emptyMessage) { |
|
|
|
if (isLoading || childrenCount > 0 || !emptyMessage) { |
|
|
|
scrollableArea = ( |
|
|
|
scrollableArea = ( |
|
|
|
<div className={classNames('scrollable', { fullscreen })} ref={this.setRef} onMouseMove={this.handleMouseMove} onMouseLeave={this.handleMouseLeave}> |
|
|
|
<div className={classNames('scrollable', { fullscreen })} ref={this.setRef}> |
|
|
|
<div role='feed' className='item-list'> |
|
|
|
<div role='feed' className='item-list'> |
|
|
|
{prepend} |
|
|
|
{prepend} |
|
|
|
|
|
|
|
|
|
|
|