Merge pull request #12354 from ramonlsouza/new-message-chat-scroll
fix: handle new message auto-scroll in chat
This commit is contained in:
commit
bd51a191bd
@ -104,8 +104,19 @@ class TimeWindowList extends PureComponent {
|
||||
syncedPercent,
|
||||
lastTimeWindowValuesBuild,
|
||||
scrollPosition: scrollProps,
|
||||
count
|
||||
} = this.props;
|
||||
|
||||
const { userScrolledBack } = this.state;
|
||||
|
||||
if((count > 0 && !userScrolledBack) || userSentMessage){
|
||||
const lastItemIndex = timeWindowsValues.length - 1;
|
||||
|
||||
this.setState({
|
||||
scrollPosition: lastItemIndex,
|
||||
}, ()=> this.handleScrollUpdate(lastItemIndex));
|
||||
}
|
||||
|
||||
const {
|
||||
timeWindowsValues: prevTimeWindowsValues,
|
||||
chatId: prevChatId,
|
||||
@ -304,10 +315,11 @@ class TimeWindowList extends PureComponent {
|
||||
const {
|
||||
scrollArea,
|
||||
scrollPosition,
|
||||
userScrolledBack,
|
||||
} = this.state;
|
||||
ChatLogger.debug('TimeWindowList::render', {...this.props}, {...this.state}, new Date());
|
||||
|
||||
const shouldAutoScroll = !!(scrollPosition && timeWindowsValues.length >= scrollPosition);
|
||||
const shouldAutoScroll = !!(scrollPosition && timeWindowsValues.length >= scrollPosition && !userScrolledBack);
|
||||
|
||||
return (
|
||||
[<div
|
||||
|
Loading…
Reference in New Issue
Block a user