When you send a message, scroll it into view
This commit is contained in:
parent
b9518ed0c5
commit
a3525c16ef
14 changed files with 387 additions and 438 deletions
|
@ -77,14 +77,13 @@ export type PropsDataType = {
|
|||
haveNewest: boolean;
|
||||
haveOldest: boolean;
|
||||
isLoadingMessages: boolean;
|
||||
isNearBottom: boolean;
|
||||
isNearBottom?: boolean;
|
||||
items: ReadonlyArray<string>;
|
||||
loadCountdownStart: number | undefined;
|
||||
messageHeightChangeIndex: number | undefined;
|
||||
oldestUnreadIndex: number | undefined;
|
||||
loadCountdownStart?: number;
|
||||
messageHeightChangeIndex?: number;
|
||||
oldestUnreadIndex?: number;
|
||||
resetCounter: number;
|
||||
scrollToBottomCounter: number;
|
||||
scrollToIndex: number | undefined;
|
||||
scrollToIndex?: number;
|
||||
scrollToIndexCounter: number;
|
||||
totalUnread: number;
|
||||
};
|
||||
|
@ -957,7 +956,7 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
|
|||
this.scrollDown(false);
|
||||
};
|
||||
|
||||
public scrollDown = (setFocus?: boolean, forceScrollDown?: boolean): void => {
|
||||
public scrollDown = (setFocus?: boolean): void => {
|
||||
const {
|
||||
haveNewest,
|
||||
id,
|
||||
|
@ -974,7 +973,7 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
|
|||
const lastId = items[items.length - 1];
|
||||
const lastSeenIndicatorRow = this.getLastSeenIndicatorRow();
|
||||
|
||||
if (!this.visibleRows || forceScrollDown) {
|
||||
if (!this.visibleRows) {
|
||||
if (haveNewest) {
|
||||
this.scrollToBottom(setFocus);
|
||||
} else if (!isLoadingMessages) {
|
||||
|
@ -1031,7 +1030,6 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
|
|||
messageHeightChangeIndex,
|
||||
oldestUnreadIndex,
|
||||
resetCounter,
|
||||
scrollToBottomCounter,
|
||||
scrollToIndex,
|
||||
typingContactId,
|
||||
} = this.props;
|
||||
|
@ -1049,10 +1047,6 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
|
|||
this.resizeHeroRow();
|
||||
}
|
||||
|
||||
if (scrollToBottomCounter !== prevProps.scrollToBottomCounter) {
|
||||
this.scrollDown(false, true);
|
||||
}
|
||||
|
||||
// There are a number of situations which can necessitate that we forget about row
|
||||
// heights previously calculated. We reset the minimum number of rows to minimize
|
||||
// unexpected changes to the scroll position. Those changes happen because
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue