Skip to content

Commit caa304f

Browse files
author
Claudéric Demers
authored
Merge pull request #27 from wodup/master
Fix misuse of second argument as nextState (the actual argument is prevState)
2 parents 0b446dc + 5d64e3e commit caa304f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ export default class VirtualList extends React.PureComponent<Props, State> {
183183
}
184184
}
185185

186-
componentDidUpdate(_: Props, nextState: State) {
187-
const {offset} = this.state;
186+
componentDidUpdate(_: Props, prevState: State) {
187+
const {offset, scrollChangeReason} = this.state;
188188

189-
if (nextState.offset !== offset && nextState.scrollChangeReason === SCROLL_CHANGE_REQUESTED) {
189+
if (prevState.offset !== offset && scrollChangeReason === SCROLL_CHANGE_REQUESTED) {
190190
this.scrollTo(offset);
191191
}
192192
}

0 commit comments

Comments
 (0)