Don't reset scroll position when opening a modal

This commit is contained in:
Thibaut Girka
2018-07-27 17:59:52 +02:00
committed by ThibG
parent 5d060cb6e4
commit b02bfe86ce
15 changed files with 75 additions and 5 deletions

View File

@@ -47,6 +47,10 @@ export default class CommunityTimeline extends React.PureComponent {
this.props.dispatch(expandCommunityTimeline({ maxId }));
}
shouldUpdateScroll = (prevRouterProps, { location }) => {
return !(location.state && location.state.mastodonModalOpen)
}
render () {
const { intl } = this.props;
@@ -62,6 +66,7 @@ export default class CommunityTimeline extends React.PureComponent {
timelineId='community'
onLoadMore={this.handleLoadMore}
scrollKey='standalone_public_timeline'
shouldUpdateScroll={this.shouldUpdateScroll}
trackScroll={false}
/>
</Column>

View File

@@ -41,6 +41,10 @@ export default class HashtagTimeline extends React.PureComponent {
this.props.dispatch(expandHashtagTimeline(this.props.hashtag, { maxId }));
}
shouldUpdateScroll = (prevRouterProps, { location }) => {
return !(location.state && location.state.mastodonModalOpen)
}
render () {
const { hashtag } = this.props;
@@ -55,6 +59,7 @@ export default class HashtagTimeline extends React.PureComponent {
<StatusListContainer
trackScroll={false}
scrollKey='standalone_hashtag_timeline'
shouldUpdateScroll={this.shouldUpdateScroll}
timelineId={`hashtag:${hashtag}`}
onLoadMore={this.handleLoadMore}
/>