-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable autoWidth on Grid in combination with horizontal WindowScroller #644
Conversation
Because no one has needed it before now and it takes time and effort to implement things. 😛 Plus once a thing has been implemented, I'm stuck supporting it forever and people who use react-virtualized have to accept a slightly larger payload size and potentially slightly slower runtime. I'm not really convinced this is a useful feature. Why would you want a |
To be clear~ I appreciate the PR! 😄 (thank you!) I'm just not sure about this feature. |
This wasn't meant as a reproach 😉 I'm building a kanban/trello like application (teamgridapp.com). At this time, I'm kicking out our legacy UI framework and rewrite the views in React. Our main view shows all team members in horizontal aligned lists, which I want to virtualize. There're some reasons (styling, sortable, etc.), why these lists don't have a own scrollable div and use one of the parents for scrolling instead. |
No worries 😄 Sorry if my reaction seemed defensive. Harder to communicate when sleepy. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some comments for small things on the PR, but I went ahead and made those changes myself while reviewing to reduce the number of back-and-forth cycles.
This will go out with the next release, 9.6.0
Thanks for the contribution and the discussion.
const grid = render(getMarkup(props)) | ||
const rendered = findDOMNode(grid) | ||
expect(rendered.querySelector('.ReactVirtualized__Grid__innerScrollContainer').style.width).toEqual('2500px') // 50 columns * 50px columnWidth | ||
expect(grid._rowSizeAndPositionManager.getTotalSize()).toEqual(2000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be checking total column size:
expect(grid._columnSizeAndPositionManager.getTotalSize()).toEqual(2500)
I can patch this.
) | ||
) { | ||
this._scrollingContainer.scrollLeft = scrollLeft | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you meant to add this conditional above. As it is, it actually checksscrollLeft
1 or 2 times.
@@ -1104,6 +1122,9 @@ export default class Grid extends PureComponent { | |||
if (!autoHeight) { | |||
newState.scrollTop = scrollTop | |||
} | |||
if (!autoWidth) { | |||
newState.scrollLeft = scrollLeft |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same type of comment here. scrollLeft
has already been set above, inline, within newState
.
|
||
mockGetBoundingClientRectForHeader({ | ||
height: 200 | ||
height: 200, | ||
width: 200 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I usually like to use different values for width/height or scrollLeft/scrollTop to avoid possibly missing a bug where I transpose the 2 internally.
|
||
this.state = { | ||
height, | ||
width, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
state
should probably initialize scrollLeft
to 0 as well
9.6.0 release just went out with this. |
Wow, this was fast! Thank you for applying the changes and for all the great work with this package! |
Adds the ability to use
WindowScroller
to detect horizontal scrolling. This allows the usage ofautoWidth
on theGrid
component.I'm not sure why these two cases weren't already implemented.