From a8244c2820a4f2b08e14d75eb9eab5aa90eb95ef Mon Sep 17 00:00:00 2001 From: yamaha252 Date: Mon, 10 Dec 2018 17:48:01 +0500 Subject: [PATCH] fix scrolling on old mobile devices --- src/chat/message-area.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/chat/message-area.js b/src/chat/message-area.js index 90b8630..001041e 100644 --- a/src/chat/message-area.js +++ b/src/chat/message-area.js @@ -5,7 +5,14 @@ const dayInMillis = 60 * 60 * 24 * 1000; export default class MessageArea extends Component { scrollToBottom() { - this.messagesEnd.scrollIntoView({ behavior: 'smooth' }); + if (this.chat && 'scrollTo' in this.chat) { + this.chat.scrollTo({ + top: this.chat.scrollHeight - this.chat.clientHeight, + behavior: 'smooth', + }); + } else { + this.chat.scrollTop = this.chat.scrollHeight - this.chat.clientHeight; + } } focus() { @@ -46,7 +53,6 @@ export default class MessageArea extends Component { ); })} -
{this.messagesEnd = el;}}/>
); }