Prevent pinned columns from scroll to top on URL changing (#3586)

This commit is contained in:
unarist 2017-06-05 22:20:46 +09:00 committed by Eugen Rochko
parent 1f1d6bf2a0
commit c26cea262b
6 changed files with 27 additions and 9 deletions

View File

@ -15,6 +15,7 @@ class StatusList extends ImmutablePureComponent {
onScrollToBottom: PropTypes.func,
onScrollToTop: PropTypes.func,
onScroll: PropTypes.func,
trackScroll: PropTypes.bool,
shouldUpdateScroll: PropTypes.func,
isLoading: PropTypes.bool,
isUnread: PropTypes.bool,
@ -88,7 +89,7 @@ class StatusList extends ImmutablePureComponent {
}
render () {
const { statusIds, onScrollToBottom, scrollKey, shouldUpdateScroll, isLoading, isUnread, hasMore, prepend, emptyMessage } = this.props;
const { statusIds, onScrollToBottom, scrollKey, trackScroll, shouldUpdateScroll, isLoading, isUnread, hasMore, prepend, emptyMessage } = this.props;
let loadMore = null;
let scrollableArea = null;
@ -126,11 +127,15 @@ class StatusList extends ImmutablePureComponent {
);
}
return (
<ScrollContainer scrollKey={scrollKey} shouldUpdateScroll={shouldUpdateScroll}>
{scrollableArea}
</ScrollContainer>
);
if (trackScroll) {
return (
<ScrollContainer scrollKey={scrollKey} shouldUpdateScroll={shouldUpdateScroll}>
{scrollableArea}
</ScrollContainer>
);
} else {
return scrollableArea;
}
}
}

View File

@ -124,6 +124,7 @@ class CommunityTimeline extends React.PureComponent {
<StatusListContainer
{...this.props}
trackScroll={!pinned}
scrollKey={`community_timeline-${columnId}`}
type='community'
emptyMessage={<FormattedMessage id='empty_column.community' defaultMessage='The local timeline is empty. Write something publicly to get the ball rolling!' />}

View File

@ -120,6 +120,7 @@ class HashtagTimeline extends React.PureComponent {
/>
<StatusListContainer
trackScroll={!pinned}
scrollKey={`hashtag_timeline-${columnId}`}
type='tag'
id={id}

1