Skip to content

Commit e786509

Browse files
committed
Reactions keep list at bottom
1 parent 120c7f0 commit e786509

File tree

3 files changed

+25
-14
lines changed

3 files changed

+25
-14
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"react-markdown": "^5.0.3",
4343
"react-player": "^2.7.0",
4444
"react-textarea-autosize": "^8.3.0",
45-
"react-virtuoso": "^1.5.8",
45+
"react-virtuoso": "1.5.9",
4646
"textarea-caret": "^3.1.0",
4747
"uuid": "^8.3.1"
4848
},

src/components/MessageList/VirtualizedMessageList.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,19 @@ const VirtualizedMessageList = ({
113113
);
114114

115115
/**
116-
* setting 'overflow: auto' traps CSS margins of the item elements, preventing incorrect item measurements.
116+
* using 'display: inline-block' traps CSS margins of the item elements, preventing incorrect item measurements.
117117
* @type {import('react-virtuoso').Components['Item']}
118118
*/
119119
const Item = (props) => {
120-
return <div {...props} style={{ overflow: 'auto' }} />;
120+
return (
121+
<div
122+
{...props}
123+
style={{
124+
display: 'inline-block',
125+
width: '100%',
126+
}}
127+
/>
128+
);
121129
};
122130

123131
const Footer = () => {
@@ -143,14 +151,17 @@ const VirtualizedMessageList = ({
143151
ref={virtuoso}
144152
totalCount={messages.length}
145153
overscan={overscan}
154+
style={{ overflowX: 'hidden' }}
146155
followOutput={(isAtBottom) => {
147156
if (shouldForceScrollToBottom()) {
148157
return isAtBottom ? stickToBottomScrollBehavior : 'auto';
149158
}
150159
// a message from another user has been received - don't scroll to bottom unless already there
151160
return isAtBottom ? stickToBottomScrollBehavior : false;
152161
}}
153-
itemContent={(i) => messageRenderer(messages, i)}
162+
itemContent={(i) => {
163+
return messageRenderer(messages, i);
164+
}}
154165
components={virtuosoComponents}
155166
firstItemIndex={PREPEND_OFFSET - numItemsPrepended}
156167
startReached={() => {

yarn.lock

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9907,6 +9907,16 @@ react-view-pager@^0.6.0:
99079907
resize-observer-polyfill "1.5.0"
99089908
tabbable "1.1.2"
99099909

9910+
9911+
version "1.5.9"
9912+
resolved "https://registry.yarnpkg.com/react-virtuoso/-/react-virtuoso-1.5.9.tgz#1c64d093df7c67c07ca3813780e2c65cf07d5efa"
9913+
integrity sha512-r3nE98ElMWtI9rtLlPT5iVcN/cwkm1dyDXVdJ1LVdoVPGhiyTa4yTIgLR8AEiU8s65BvCcl50efEPVVqf+5MsA==
9914+
dependencies:
9915+
"@virtuoso.dev/react-urx" "^0.2.5"
9916+
"@virtuoso.dev/urx" "^0.2.5"
9917+
react-app-polyfill "^1.0.6"
9918+
resize-observer-polyfill "^1.5.1"
9919+
99109920
react-virtuoso@^0.20.3:
99119921
version "0.20.3"
99129922
resolved "https://registry.yarnpkg.com/react-virtuoso/-/react-virtuoso-0.20.3.tgz#dde89d9d84f10a029ddbe61ac22fa416b51e0119"
@@ -9915,16 +9925,6 @@ react-virtuoso@^0.20.3:
99159925
resize-observer-polyfill "^1.5.1"
99169926
tslib "^1.11.1"
99179927

9918-
react-virtuoso@^1.5.8:
9919-
version "1.5.8"
9920-
resolved "https://registry.yarnpkg.com/react-virtuoso/-/react-virtuoso-1.5.8.tgz#137d4dc5ee82e55302f39c73479f2d1d7e2a10cd"
9921-
integrity sha512-GPLkT+PrP5mwLFgsUJcCmmc63Gw05cbGh4jvzGQu0jWqWUKFzNn0O0JvTEOIScQ65o2JV9Dxoz5ZLNtwyNgw5w==
9922-
dependencies:
9923-
"@virtuoso.dev/react-urx" "^0.2.5"
9924-
"@virtuoso.dev/urx" "^0.2.5"
9925-
react-app-polyfill "^1.0.6"
9926-
resize-observer-polyfill "^1.5.1"
9927-
99289928
react@^16.2.0:
99299929
version "16.14.0"
99309930
resolved "https://registry.yarnpkg.com/react/-/react-16.14.0.tgz#94d776ddd0aaa37da3eda8fc5b6b18a4c9a3114d"

0 commit comments

Comments
 (0)