mirror of
https://github.com/mastodon/mastodon.git
synced 2024-11-15 03:15:32 +00:00
Merge pull request #465 from ThibG/glitch-soc/rollback-scroll-changes
Glitch soc/rollback scroll changes
This commit is contained in:
commit
2e25da4da0
|
@ -35,7 +35,6 @@ export default class ScrollableList extends PureComponent {
|
|||
|
||||
state = {
|
||||
fullscreen: null,
|
||||
mouseOver: false,
|
||||
};
|
||||
|
||||
intersectionObserverWrapper = new IntersectionObserverWrapper();
|
||||
|
@ -86,7 +85,7 @@ export default class ScrollableList extends PureComponent {
|
|||
const someItemInserted = React.Children.count(prevProps.children) > 0 &&
|
||||
React.Children.count(prevProps.children) < React.Children.count(this.props.children) &&
|
||||
this.getFirstChildKey(prevProps) !== this.getFirstChildKey(this.props);
|
||||
if (someItemInserted && this.node.scrollTop > 0 || (this.state.mouseOver && !prevProps.isLoading)) {
|
||||
if (someItemInserted && this.node.scrollTop > 0) {
|
||||
return this.node.scrollHeight - this.node.scrollTop;
|
||||
} else {
|
||||
return null;
|
||||
|
@ -148,14 +147,6 @@ export default class ScrollableList extends PureComponent {
|
|||
this.props.onScrollToBottom();
|
||||
}
|
||||
|
||||
handleMouseEnter = () => {
|
||||
this.setState({ mouseOver: true });
|
||||
}
|
||||
|
||||
handleMouseLeave = () => {
|
||||
this.setState({ mouseOver: false });
|
||||
}
|
||||
|
||||
render () {
|
||||
const { children, scrollKey, trackScroll, shouldUpdateScroll, isLoading, hasMore, prepend, emptyMessage } = this.props;
|
||||
const { fullscreen } = this.state;
|
||||
|
@ -166,7 +157,7 @@ export default class ScrollableList extends PureComponent {
|
|||
|
||||
if (isLoading || childrenCount > 0 || !emptyMessage) {
|
||||
scrollableArea = (
|
||||
<div className={classNames('scrollable', { fullscreen })} ref={this.setRef} onMouseEnter={this.handleMouseEnter} onMouseLeave={this.handleMouseLeave}>
|
||||
<div className={classNames('scrollable', { fullscreen })} ref={this.setRef}>
|
||||
<div role='feed' className='item-list'>
|
||||
{prepend}
|
||||
|
||||
|
|
Loading…
Reference in a new issue