Revert "Fixed scrolling via jump list on series index"
This reverts commit 5d316ad7dc
.
This commit is contained in:
parent
519a5ca75c
commit
076ad5fe6d
|
@ -7,6 +7,8 @@ import { WindowScroller, Grid } from 'react-virtualized';
|
|||
import hasDifferentItemsOrOrder from 'Utilities/Object/hasDifferentItemsOrOrder';
|
||||
import styles from './VirtualTable.css';
|
||||
|
||||
const ROW_HEIGHT = 38;
|
||||
|
||||
function overscanIndicesGetter(options) {
|
||||
const {
|
||||
cellCount,
|
||||
|
@ -45,7 +47,8 @@ class VirtualTable extends Component {
|
|||
|
||||
componentDidUpdate(prevProps, prevState) {
|
||||
const {
|
||||
items
|
||||
items,
|
||||
scrollIndex
|
||||
} = this.props;
|
||||
|
||||
const {
|
||||
|
@ -56,6 +59,13 @@ class VirtualTable extends Component {
|
|||
// recomputeGridSize also forces Grid to discard its cache of rendered cells
|
||||
this._grid.recomputeGridSize();
|
||||
}
|
||||
|
||||
if (scrollIndex != null && scrollIndex !== prevProps.scrollIndex) {
|
||||
this._grid.scrollToCell({
|
||||
rowIndex: scrollIndex,
|
||||
columnIndex: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -86,8 +96,6 @@ class VirtualTable extends Component {
|
|||
header,
|
||||
headerHeight,
|
||||
rowRenderer,
|
||||
rowHeight,
|
||||
scrollIndex,
|
||||
...otherProps
|
||||
} = this.props;
|
||||
|
||||
|
@ -117,11 +125,6 @@ class VirtualTable extends Component {
|
|||
if (!height) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const finalScrollTop = scrollIndex == null ?
|
||||
scrollTop :
|
||||
scrollIndex * rowHeight;
|
||||
|
||||
return (
|
||||
<Measure
|
||||
whitelist={['width']}
|
||||
|
@ -141,11 +144,11 @@ class VirtualTable extends Component {
|
|||
width={width}
|
||||
height={height}
|
||||
headerHeight={height - headerHeight}
|
||||
rowHeight={rowHeight}
|
||||
rowHeight={ROW_HEIGHT}
|
||||
rowCount={items.length}
|
||||
columnCount={1}
|
||||
columnWidth={width}
|
||||
scrollTop={finalScrollTop}
|
||||
scrollTop={scrollTop}
|
||||
onScroll={onChildScroll}
|
||||
overscanRowCount={2}
|
||||
cellRenderer={rowRenderer}
|
||||
|
|
|
@ -270,7 +270,6 @@ SeriesIndexOverview.propTypes = {
|
|||
};
|
||||
|
||||
SeriesIndexOverview.defaultProps = {
|
||||
overview: '',
|
||||
statistics: {
|
||||
seasonCount: 0,
|
||||
episodeCount: 0,
|
||||
|
|
|
@ -71,6 +71,7 @@ class SeriesIndexOverviews extends Component {
|
|||
items,
|
||||
sortKey,
|
||||
overviewOptions,
|
||||
jumpToCharacter,
|
||||
isSmallScreen
|
||||
} = this.props;
|
||||
|
||||
|
@ -95,6 +96,18 @@ class SeriesIndexOverviews extends Component {
|
|||
// recomputeGridSize also forces Grid to discard its cache of rendered cells
|
||||
this._grid.recomputeGridSize();
|
||||
}
|
||||
|
||||
if (jumpToCharacter != null && jumpToCharacter !== prevProps.jumpToCharacter) {
|
||||
const index = getIndexOfFirstCharacter(items, jumpToCharacter);
|
||||
|
||||
if (this._grid && index != null) {
|
||||
|
||||
this._grid.scrollToCell({
|
||||
rowIndex: index,
|
||||
columnIndex: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -188,7 +201,6 @@ class SeriesIndexOverviews extends Component {
|
|||
const {
|
||||
scroller,
|
||||
items,
|
||||
jumpToCharacter,
|
||||
isSmallScreen
|
||||
} = this.props;
|
||||
|
||||
|
@ -210,24 +222,6 @@ class SeriesIndexOverviews extends Component {
|
|||
return <div />;
|
||||
}
|
||||
|
||||
let finalScrollTop = scrollTop;
|
||||
|
||||
if (jumpToCharacter != null) {
|
||||
const index = getIndexOfFirstCharacter(items, jumpToCharacter);
|
||||
|
||||
if (index != null) {
|
||||
if (index > 0) {
|
||||
// Adjust 5px upwards so there is a gap between the bottom
|
||||
// of the toolbar and top of the poster.
|
||||
|
||||
finalScrollTop = rowHeight * index - 5;
|
||||
} else {
|
||||
finalScrollTop = 0;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div ref={registerChild}>
|
||||
<Grid
|
||||
|
@ -241,7 +235,7 @@ class SeriesIndexOverviews extends Component {
|
|||
rowHeight={rowHeight}
|
||||
width={width}
|
||||
onScroll={onChildScroll}
|
||||
scrollTop={finalScrollTop}
|
||||
scrollTop={scrollTop}
|
||||
overscanRowCount={2}
|
||||
cellRenderer={this.cellRenderer}
|
||||
scrollToAlignment={'start'}
|
||||
|
|
|
@ -114,6 +114,7 @@ class SeriesIndexPosters extends Component {
|
|||
items,
|
||||
sortKey,
|
||||
posterOptions,
|
||||
jumpToCharacter,
|
||||
isSmallScreen
|
||||
} = this.props;
|
||||
|
||||
|
@ -138,6 +139,19 @@ class SeriesIndexPosters extends Component {
|
|||
// recomputeGridSize also forces Grid to discard its cache of rendered cells
|
||||
this._grid.recomputeGridSize();
|
||||
}
|
||||
|
||||
if (jumpToCharacter != null && jumpToCharacter !== prevProps.jumpToCharacter) {
|
||||
const index = getIndexOfFirstCharacter(items, jumpToCharacter);
|
||||
|
||||
if (this._grid && index != null) {
|
||||
const row = Math.floor(index / columnCount);
|
||||
|
||||
this._grid.scrollToCell({
|
||||
rowIndex: row,
|
||||
columnIndex: 0
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -242,7 +256,6 @@ class SeriesIndexPosters extends Component {
|
|||
const {
|
||||
scroller,
|
||||
items,
|
||||
jumpToCharacter,
|
||||
isSmallScreen
|
||||
} = this.props;
|
||||
|
||||
|
@ -268,18 +281,6 @@ class SeriesIndexPosters extends Component {
|
|||
return <div />;
|
||||
}
|
||||
|
||||
let finalScrollTop = scrollTop;
|
||||
|
||||
if (jumpToCharacter != null) {
|
||||
const index = getIndexOfFirstCharacter(items, jumpToCharacter);
|
||||
|
||||
if (index != null) {
|
||||
const row = Math.floor(index / columnCount);
|
||||
|
||||
finalScrollTop = rowHeight * row;
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div ref={registerChild}>
|
||||
<Grid
|
||||
|
@ -293,7 +294,7 @@ class SeriesIndexPosters extends Component {
|
|||
rowHeight={rowHeight}
|
||||
width={width}
|
||||
onScroll={onChildScroll}
|
||||
scrollTop={finalScrollTop}
|
||||
scrollTop={scrollTop}
|
||||
overscanRowCount={2}
|
||||
cellRenderer={this.cellRenderer}
|
||||
scrollToAlignment={'start'}
|
||||
|
|
Loading…
Reference in New Issue