Skip to content

Commit

Permalink
fix: viewable items while list is inverted
Browse files Browse the repository at this point in the history
  • Loading branch information
ArekChr committed Jul 18, 2023
1 parent ad90ffb commit d4571bb
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1424,14 +1424,23 @@ class VirtualizedList extends React.PureComponent<Props, State> {
}
};

_selectClientLength(parentNode) {
return !horizontalOrDefault(this.props.horizontal) ? parentNode.clientHeight : parentNode.clientWidth;
}

_onCellLayout(e, cellKey, index) {
const layout = e.nativeEvent.layout;
const target = e.nativeEvent.target;
const next = {
offset: this._selectOffset(layout),
length: this._selectLength(layout),
index,
inLayout: true,
};

if (this.props.inverted) {
next.offset = this._selectClientLength(target.parentNode) - next.offset - next.length;
}
const curr = this._frames[cellKey];
if (
!curr ||
Expand Down

0 comments on commit d4571bb

Please sign in to comment.