diff options
author | Joram Wilander <jwawilander@gmail.com> | 2016-08-30 18:55:29 -0400 |
---|---|---|
committer | enahum <nahumhbl@gmail.com> | 2016-08-30 19:55:29 -0300 |
commit | 58242905d62418c5cc4749dcac957378459eeb24 (patch) | |
tree | 088afec512fea9547a9a001ed0f2fd1625383053 | |
parent | 3e14e8b5abee937b02b99f19730797cfa4390598 (diff) | |
download | chat-58242905d62418c5cc4749dcac957378459eeb24.tar.gz chat-58242905d62418c5cc4749dcac957378459eeb24.tar.bz2 chat-58242905d62418c5cc4749dcac957378459eeb24.zip |
Fix scrollHeight console error when logging out of iOS app (#3909)
-rw-r--r-- | webapp/components/post_view/components/post_list.jsx | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/webapp/components/post_view/components/post_list.jsx b/webapp/components/post_view/components/post_list.jsx index f891afdb3..b008245f6 100644 --- a/webapp/components/post_view/components/post_list.jsx +++ b/webapp/components/post_view/components/post_list.jsx @@ -49,6 +49,7 @@ export default class PostList extends React.Component { this.jumpToPostNode = null; this.wasAtBottom = true; this.scrollHeight = 0; + this.animationFrameId = 0; this.scrollStopAction = new DelayedAction(this.handleScrollStop); @@ -431,7 +432,7 @@ export default class PostList extends React.Component { } scrollToBottom() { - window.requestAnimationFrame(() => { + this.animationFrameId = window.requestAnimationFrame(() => { this.refs.postlist.scrollTop = this.refs.postlist.scrollHeight; }); } @@ -464,13 +465,14 @@ export default class PostList extends React.Component { } componentWillUnmount() { + window.cancelAnimationFrame(this.animationFrameId); window.removeEventListener('resize', this.handleResize); window.removeEventListener('keydown', this.handleKeyDown); this.scrollStopAction.cancel(); } componentDidUpdate() { - if (this.props.postList != null) { + if (this.props.postList != null && this.refs.postlist) { this.updateScrolling(); } } |