Skip to content

Commit

Permalink
Fixed chat not scrolling on new messages
Browse files Browse the repository at this point in the history
  • Loading branch information
idoco committed Jul 19, 2017
1 parent d140469 commit 8067058
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/chat/message-area.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,13 @@ import { h, Component } from 'preact';
const dayInMillis = 60 * 60 * 24 * 1000;

export default class MessageArea extends Component {
scrollToBottom = () => {
const intergramChat = document.getElementById('intergramChat');
intergramChat.scrollTop = intergramChat.scrollHeight;
}

componentDidMount() {
this.scrollToBottom();
window.scrollTo(0, document.body.scrollHeight);
}

componentDidUpdate() {
this.scrollToBottom();
window.scrollTo(0, document.body.scrollHeight);
}

render(props,{}) {
Expand Down

0 comments on commit 8067058

Please sign in to comment.