From 4d7b16bb88a8e327583105448e0ed43e9afb0027 Mon Sep 17 00:00:00 2001 From: Alexander Zinchuk Date: Thu, 30 Sep 2021 14:03:03 +0300 Subject: [PATCH] Message List: Fix notch appearing on open chat (#1479) --- src/components/middle/MessageList.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/middle/MessageList.tsx b/src/components/middle/MessageList.tsx index 6e9b079a6..0a38570b8 100644 --- a/src/components/middle/MessageList.tsx +++ b/src/components/middle/MessageList.tsx @@ -382,7 +382,7 @@ const MessageList: FC = ({ } newScrollTop = scrollHeight - offsetHeight; - scrollOffsetRef.current = Math.max(scrollHeight - newScrollTop, offsetHeight); + scrollOffsetRef.current = Math.max(Math.ceil(scrollHeight - newScrollTop), offsetHeight); // Scroll still needs to be restored after container resize if (!shouldForceScroll) { @@ -421,7 +421,7 @@ const MessageList: FC = ({ newScrollTop = scrollHeight - scrollOffset; } - resetScroll(container, newScrollTop); + resetScroll(container, Math.ceil(newScrollTop)); if (!memoFocusingIdRef.current) { isScrollTopJustUpdatedRef.current = true; @@ -430,7 +430,7 @@ const MessageList: FC = ({ }); } - scrollOffsetRef.current = Math.max(scrollHeight - newScrollTop, offsetHeight); + scrollOffsetRef.current = Math.max(Math.ceil(scrollHeight - newScrollTop), offsetHeight); if (process.env.APP_ENV === 'perf') { // eslint-disable-next-line no-console