Only scroll to top on PUSH of route #263

This commit is contained in:
James Barnsley
2018-04-02 11:24:13 +12:00
parent 9bffdf3de1
commit 99d3cf59dc
3 changed files with 9 additions and 13 deletions

View File

@ -57094,12 +57094,10 @@ var App = function (_React$Component) {
this.props.uiActions.hideContextMenu();
}
// Restore scroll to top
// TODO: Detect if we've gone BACK, and then restore to previous
// scroll position. We'll need to keep a running history of locations
// and scroll positions, which may be performance-hindering
// At this point we can capture "window.scrollY" for the previous scroll position
window.scrollTo(0, 0);
// Scroll to bottom, only if we've PUSHed to a new route
if (nextProps.location.action == 'PUSH') {
window.scrollTo(0, 0);
}
}
}
}, {

File diff suppressed because one or more lines are too long

View File

@ -92,12 +92,10 @@ class App extends React.Component{
this.props.uiActions.hideContextMenu();
}
// Restore scroll to top
// TODO: Detect if we've gone BACK, and then restore to previous
// scroll position. We'll need to keep a running history of locations
// and scroll positions, which may be performance-hindering
// At this point we can capture "window.scrollY" for the previous scroll position
window.scrollTo(0, 0);
// Scroll to bottom, only if we've PUSHed to a new route
if (nextProps.location.action == 'PUSH'){
window.scrollTo(0, 0);
}
}
}