Fix scrollHeight console error when logging out of iOS app (#3909)
Этот коммит содержится в:
коммит произвёл
enahum
родитель
3e14e8b5ab
Коммит
58242905d6
@@ -49,6 +49,7 @@ export default class PostList extends React.Component {
|
|||||||
this.jumpToPostNode = null;
|
this.jumpToPostNode = null;
|
||||||
this.wasAtBottom = true;
|
this.wasAtBottom = true;
|
||||||
this.scrollHeight = 0;
|
this.scrollHeight = 0;
|
||||||
|
this.animationFrameId = 0;
|
||||||
|
|
||||||
this.scrollStopAction = new DelayedAction(this.handleScrollStop);
|
this.scrollStopAction = new DelayedAction(this.handleScrollStop);
|
||||||
|
|
||||||
@@ -431,7 +432,7 @@ export default class PostList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
scrollToBottom() {
|
scrollToBottom() {
|
||||||
window.requestAnimationFrame(() => {
|
this.animationFrameId = window.requestAnimationFrame(() => {
|
||||||
this.refs.postlist.scrollTop = this.refs.postlist.scrollHeight;
|
this.refs.postlist.scrollTop = this.refs.postlist.scrollHeight;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -464,13 +465,14 @@ export default class PostList extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
window.cancelAnimationFrame(this.animationFrameId);
|
||||||
window.removeEventListener('resize', this.handleResize);
|
window.removeEventListener('resize', this.handleResize);
|
||||||
window.removeEventListener('keydown', this.handleKeyDown);
|
window.removeEventListener('keydown', this.handleKeyDown);
|
||||||
this.scrollStopAction.cancel();
|
this.scrollStopAction.cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate() {
|
componentDidUpdate() {
|
||||||
if (this.props.postList != null) {
|
if (this.props.postList != null && this.refs.postlist) {
|
||||||
this.updateScrolling();
|
this.updateScrolling();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user