-
-
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
Solution: Compability with react-custom-scrollbars #692
Comments
I don't understand this comment on #143:
I guess |
If you'd like to submit a PR I'll review it. |
@bvaughn ah, yes, you're right about that one. brb 👍 |
@bvaughn I'm a bit concerned that test don't pass even without my changes 🤔 |
Did you |
This is a fresh system, so I installed latest node an run |
Use |
@bvaughn 👌 Yup, it works now, thanks. |
😅 Glad to hear |
For anyone who struggles with import React, { Component } from 'react';
import { Scrollbars } from 'react-custom-scrollbars';
import { List } from 'react-virtualized';
const listStyle = {
overflowX: false,
overflowY: false,
};
export default class SmartList extends Component {
handleScroll = ({ target }) => {
const { scrollTop, scrollLeft } = target;
const { Grid: grid } = this.List;
grid.handleScrollEvent({ scrollTop, scrollLeft });
}
List = null;
render() {
const { width, height } = this.props;
return (
<Scrollbars
autoHide
style={{ width, height }}
onScroll={this.handleScroll}
>
<List
{...this.props}
ref={instance => (this.List = instance)}
style={listStyle}
/>
</Scrollbars>
);
}
} |
Hi, may I ask for help with solution from @alexpyzhianov? The method handleScrollEvent when fires and updates Grid component causes lags on scrolling. The method handleScrollEvent was bombed by scrolling events so I tried to reduce them by calling it only for scrolls of certain height. It wasnt so laggy, but still each call cause lag on scroll. Next step I tried was to call it in setTimeout to force run it in a new thread (I was desperated) - same result. Any ideas? |
@evercool have you found solution? |
Maybe another solution, it works for me: import React from 'react';
import { Scrollbars } from 'react-custom-scrollbars';
import { List, AutoSizer } from 'react-virtualized';
export class DemoList extends React.Component {
handleScroll = (e) => {
this.list.Grid._onScroll(e);
}
componentDidMount = () => {
this.list.Grid._scrollingContainer = this.scroll.view;
}
render() {
return (
<AutoSizer>
{({ height, width }) => (
<Scrollbars ref={node => this.scroll = node} onScroll={this.handleScroll} style={{ height, width }}>
<List
{...this.props}
style={{ overflowX: 'visible', overflowY: 'visible' }}
ref={node => this.list = node}
height={height}
/>
</Scrollbars>
)}
</AutoSizer>
);
}
} |
@evercool @borovik96 I'm having a similar problem. Trying to use |
Can this technique be used with the table and would it let the headers be fixed and only scroll the data? |
- npm: added `react-virtualized` - npm: added `highlight.js` at the moment I disabled highlighting the logs since it breaks the UI. The horizontal scrollbar isn't styled. This can be probably be fixed by following [this discussion](bvaughn/react-virtualized#692)
After a long discussion in #143 I also took a shot at this problem and arrived to the following solution:
You can see that I've pretty much rewritten the
_onScroll
method in https://github.com/bvaughn/react-virtualized/blob/master/source/Grid/Grid.js#L1110The simplest way to make this work will be to add a way to bypass the container node check in
_onScroll
.@bvaughn what do you think?
The text was updated successfully, but these errors were encountered: