Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
cdf8454
Add RTL support for List component
davidgarsan Mar 1, 2019
ebdb131
Fix lint error
davidgarsan Mar 1, 2019
97bd7e0
Grid scrollToItem() takes scrollbar size into consideration
Mar 2, 2019
c747a29
Only count scrollbar size in scrollToItem() when scrolling is required
Mar 3, 2019
05df0f4
Merge branch 'issues/148' of https://github.com/davidgarsan/react-win…
Mar 3, 2019
a42c2fb
Prettier
Mar 3, 2019
112f102
Renamed FixedSizeListRtl to RTLLayout
Mar 3, 2019
98c7ea7
Deprecate list direction=horizontal|vertical in favor of direction=lt…
Mar 3, 2019
ba279dc
Upgrade memoize-one to ^5.0.0
jgoz Mar 4, 2019
7d61351
Upgrade memoize-one in website
jgoz Mar 4, 2019
e5d32f3
Prettier
jgoz Mar 4, 2019
38732dd
Added 'direction' prop to grid (including docs and tests)
Mar 4, 2019
c6fa7aa
Merge pull request #156 from bvaughn/issues/148
bvaughn Mar 4, 2019
7130e03
Shrink domHelpers. Remove unnecessary style. Better minification.
Mar 4, 2019
a724ee1
Upgrade Rollup. Add Terser plug-in.
Mar 4, 2019
9c24344
Use version range for memoize-one
jgoz Mar 4, 2019
0f24e9a
Removed Rollup terser plug-in for now because it was bloating the bundle
Mar 4, 2019
84ba74a
Merge pull request #155 from jgoz/upgrade-memoize-one
bvaughn Mar 4, 2019
b2ea9ad
1.5.2 -> 1.6.0
Mar 4, 2019
fb15909
Bugfix to account for differences between Chrome and non-Chrome brows…
Mar 4, 2019
e0d0dce
1.6.0 -> 1.6.1
Mar 4, 2019
dcb9c55
Bugfix for RTL when scrolling back towards the beginning (right) of t…
Mar 4, 2019
7b5dd7c
1.6.1 -> 1.6.2
Mar 4, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changelog
------------

### 1.6.2
* 🐛 Bugfix for RTL when scrolling back towards the beginning (right) of the list.

### 1.6.1
* 🐛 Bugfix to account for differences between Chrome and non-Chrome browsers with regard to RTL and "scroll" events.

### 1.6.0
* 🎉 RTL support added for lists and grids. Special thanks to [davidgarsan](https://github.com/davidgarsan) for his support. - [#156](https://github.com/bvaughn/react-window/pull/156)
* 🐛 Grid `scrollToItem` methods take scrollbar size into account when aligning items - [#153](https://github.com/bvaughn/react-window/issues/153)

### 1.5.2
* 🐛 Edge case bug fix for `VariableSizeList` and `VariableSizeGrid` when the number of items decreases while a scroll is in progress. - ([iamsolankiamit](https://github.com/iamsolankiamit) - [#138](https://github.com/bvaughn/react-window/pull/138))

Expand Down
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-window",
"version": "1.5.2",
"version": "1.6.2",
"description":
"React components for efficiently rendering large, scrollable lists and tabular data",
"author":
Expand Down Expand Up @@ -61,7 +61,7 @@
},
"dependencies": {
"@babel/runtime": "^7.0.0",
"memoize-one": "^3.1.1"
"memoize-one": ">=3.1.1 <6"
},
"peerDependencies": {
"react": "^15.0.0 || ^16.0.0",
Expand Down Expand Up @@ -99,9 +99,9 @@
"react-dom": "^16.7.0",
"react-scripts": "^1.1.1",
"react-test-renderer": "^16.7.0",
"rollup": "^0.65.0",
"rollup-plugin-babel": "^4.0.2",
"rollup-plugin-commonjs": "^8.2.1",
"rollup-plugin-node-resolve": "^3.0.2"
"rollup": "^1.4.1",
"rollup-plugin-babel": "^4.3.2",
"rollup-plugin-commonjs": "^9.2.1",
"rollup-plugin-node-resolve": "^4.0.1"
}
}
1 change: 1 addition & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import babel from 'rollup-plugin-babel';
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';

import pkg from './package.json';

const input = './src/index.js';
Expand Down
10 changes: 8 additions & 2 deletions src/FixedSizeGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const FixedSizeGrid = createGridComponent({
{ columnCount, columnWidth, width }: Props<any>,
columnIndex: number,
align: ScrollToAlign,
scrollLeft: number
scrollLeft: number,
instanceProps: typeof undefined,
scrollbarSize: number
): number => {
const maxOffset = Math.max(
0,
Expand All @@ -40,6 +42,7 @@ const FixedSizeGrid = createGridComponent({
0,
columnIndex * ((columnWidth: any): number) -
width +
scrollbarSize +
((columnWidth: any): number)
);

Expand All @@ -66,7 +69,9 @@ const FixedSizeGrid = createGridComponent({
{ rowHeight, height, rowCount }: Props<any>,
rowIndex: number,
align: ScrollToAlign,
scrollTop: number
scrollTop: number,
instanceProps: typeof undefined,
scrollbarSize: number
): number => {
const maxOffset = Math.max(
0,
Expand All @@ -79,6 +84,7 @@ const FixedSizeGrid = createGridComponent({
0,
rowIndex * ((rowHeight: any): number) -
height +
scrollbarSize +
((rowHeight: any): number)
);

Expand Down
12 changes: 8 additions & 4 deletions src/FixedSizeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ const FixedSizeList = createListComponent({
((itemSize: any): number) * itemCount,

getOffsetForIndexAndAlignment: (
{ direction, height, itemCount, itemSize, width }: Props<any>,
{ direction, height, itemCount, itemSize, layout, width }: Props<any>,
index: number,
align: ScrollToAlign,
scrollOffset: number
): number => {
const size = (((direction === 'horizontal' ? width : height): any): number);
// TODO Deprecate direction "horizontal"
const isHorizontal = direction === 'horizontal' || layout === 'horizontal';
const size = (((isHorizontal ? width : height): any): number);
const maxOffset = Math.max(
0,
Math.min(
Expand Down Expand Up @@ -62,12 +64,14 @@ const FixedSizeList = createListComponent({
),

getStopIndexForStartIndex: (
{ direction, height, itemCount, itemSize, width }: Props<any>,
{ direction, height, itemCount, itemSize, layout, width }: Props<any>,
startIndex: number,
scrollOffset: number
): number => {
// TODO Deprecate direction "horizontal"
const isHorizontal = direction === 'horizontal' || layout === 'horizontal';
const offset = startIndex * ((itemSize: any): number);
const size = (((direction === 'horizontal' ? width : height): any): number);
const size = (((isHorizontal ? width : height): any): number);
return Math.max(
0,
Math.min(
Expand Down
20 changes: 14 additions & 6 deletions src/VariableSizeGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,8 @@ const getOffsetForIndexAndAlignment = (
index: number,
align: ScrollToAlign,
scrollOffset: number,
instanceProps: InstanceProps
instanceProps: InstanceProps,
scrollbarSize: number
): number => {
const size = itemType === 'column' ? props.width : props.height;
const itemMetadata = getItemMetadata(itemType, props, index, instanceProps);
Expand All @@ -249,7 +250,10 @@ const getOffsetForIndexAndAlignment = (
0,
Math.min(estimatedTotalSize - size, itemMetadata.offset)
);
const minOffset = Math.max(0, itemMetadata.offset - size + itemMetadata.size);
const minOffset = Math.max(
0,
itemMetadata.offset - size + scrollbarSize + itemMetadata.size
);

switch (align) {
case 'start':
Expand Down Expand Up @@ -324,31 +328,35 @@ const VariableSizeGrid = createGridComponent({
index: number,
align: ScrollToAlign,
scrollOffset: number,
instanceProps: InstanceProps
instanceProps: InstanceProps,
scrollbarSize: number
): number =>
getOffsetForIndexAndAlignment(
'column',
props,
index,
align,
scrollOffset,
instanceProps
instanceProps,
scrollbarSize
),

getOffsetForRowAndAlignment: (
props: Props<any>,
index: number,
align: ScrollToAlign,
scrollOffset: number,
instanceProps: InstanceProps
instanceProps: InstanceProps,
scrollbarSize: number
): number =>
getOffsetForIndexAndAlignment(
'row',
props,
index,
align,
scrollOffset,
instanceProps
instanceProps,
scrollbarSize
),

getRowOffset: (
Expand Down
12 changes: 8 additions & 4 deletions src/VariableSizeList.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,9 +185,11 @@ const VariableSizeList = createListComponent({
scrollOffset: number,
instanceProps: InstanceProps
): number => {
const { direction, height, width } = props;
const { direction, height, layout, width } = props;

const size = (((direction === 'horizontal' ? width : height): any): number);
// TODO Deprecate direction "horizontal"
const isHorizontal = direction === 'horizontal' || layout === 'horizontal';
const size = (((isHorizontal ? width : height): any): number);
const itemMetadata = getItemMetadata(props, index, instanceProps);

// Get estimated total size after ItemMetadata is computed,
Expand Down Expand Up @@ -234,9 +236,11 @@ const VariableSizeList = createListComponent({
scrollOffset: number,
instanceProps: InstanceProps
): number => {
const { direction, height, itemCount, width } = props;
const { direction, height, itemCount, layout, width } = props;

const size = (((direction === 'horizontal' ? width : height): any): number);
// TODO Deprecate direction "horizontal"
const isHorizontal = direction === 'horizontal' || layout === 'horizontal';
const size = (((isHorizontal ? width : height): any): number);
const itemMetadata = getItemMetadata(props, startIndex, instanceProps);
const maxOffset = scrollOffset + size;

Expand Down
Loading