-
-
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
ScrollToIndex not scrolling as expected #1226
Comments
I have found this issue isn't apparent after downgrading |
#1179 is related |
Anyone has a workaround for this ? |
A workaround would be downgrading React. Version 16.3.2 worked for us. |
I'm using this currently as a workaround. componentDidMount(){
if (this.props.start_index < 0) {
return;
}
const initial_top = this._list_ref.getOffsetForRow({
alignment: "start",
index: this.props.start_index,
});
window.scrollTo(0, initial_top);
}
render(){
return (
<List ref={ref => this._list_ref = ref} {...other_props} scrollToIndex={this.props.start_index}/>
)
} Basically it manually calls getOffsetForRow after mounting, then scrolls the window the correct location. The I have been using this with WindowScroller, so I have no idea if it works solo as WindowScroller does things like patch the scrollTop. |
I'm badly affected by this bug, the workaround suggested didn't work for me on a regular |
I've made a PR which should fix this issue. |
Having the same issue on react and react-dom 16.3.2. Any updates? |
Hi, I'm also having the same issue, react react-dom 16.12.0, react-virtualized 9.21.2. As a work around I'm manually calculating the window scroll offset by multiplying scrollToIndex by rowHeight and then using window.scrollTo(). |
I too am encountering this issue with react/[email protected] and [email protected]. I was able to get it kinda (still seems to be a positioning bug?) by downgrading react-virtualized to 9.21.1 and using a a ref on the List component:
|
I have the same bug. so bad |
Any updates on this? |
1 similar comment
Any updates on this? |
I've created a small repro based on what we're experiencing trying to make use of
<List />
'sscrollToIndex
prop. I believe it's a bug, given how simple the repro is and how closely we've attempted to follow documentation / examples, but it's always possible we've just mixed something up.What is the current behavior?
Despite the
scrollToIndex
state in<App />
being updated, which feeds down to the<List />
'sscrollToIndex
prop, the list is not navigated to the desired list element as expected.What is the expected behavior?
The element at the index given in the number input box is navigated to.
Which versions of React and react-virtualized, and which browser / OS are affected by this issue? Did this work in previous versions of react-virtualized?
The text was updated successfully, but these errors were encountered: