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

@ -66,6 +66,10 @@ export default class Bookmarks extends ImmutablePureComponent {
this.props.dispatch(expandBookmarkedStatuses());
}, 300, { leading: true })
shouldUpdateScroll = (prevRouterProps, { location }) => {
return !(location.state && location.state.mastodonModalOpen)
}
render () {
const { intl, statusIds, columnId, multiColumn, hasMore, isLoading } = this.props;
const pinned = !!columnId;
@ -87,6 +91,7 @@ export default class Bookmarks extends ImmutablePureComponent {
trackScroll={!pinned}
statusIds={statusIds}
scrollKey={`bookmarked_statuses-${columnId}`}
shouldUpdateScroll={this.shouldUpdateScroll}
hasMore={hasMore}
isLoading={isLoading}
onLoadMore={this.handleLoadMore}