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

@ -342,6 +342,10 @@ export default class Status extends ImmutablePureComponent {
this.setState({ fullscreen: isFullscreen() });
}
shouldUpdateScroll = (prevRouterProps, { location }) => {
return !(location.state && location.state.mastodonModalOpen)
}
render () {
let ancestors, descendants;
const { setExpansion } = this;
@ -385,7 +389,7 @@ export default class Status extends ImmutablePureComponent {
)}
/>
<ScrollContainer scrollKey='thread'>
<ScrollContainer scrollKey='thread' shouldUpdateScroll={this.shouldUpdateScroll}>
<div className={classNames('scrollable', 'detailed-status__wrapper', { fullscreen })} ref={this.setRef}>
{ancestors}