Scroll to bottom of conversation on message send

This commit is contained in:
Scott Nonnenberg 2021-11-02 19:00:54 -07:00 committed by GitHub
parent 254c87a1ac
commit 5bd7eda124
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 107 additions and 21 deletions

View file

@ -61,6 +61,7 @@ export type InputApi = {
export type Props = {
readonly i18n: LocalizerType;
readonly conversationId: string;
readonly disabled?: boolean;
readonly large?: boolean;
readonly inputApi?: React.MutableRefObject<InputApi | undefined>;
@ -84,6 +85,7 @@ export type Props = {
): unknown;
getQuotedMessage(): unknown;
clearQuotedMessage(): unknown;
scrollToBottom: (converstionId: string) => unknown;
};
const MAX_LENGTH = 64 * 1024;
@ -92,6 +94,7 @@ const BASE_CLASS_NAME = 'module-composition-input';
export function CompositionInput(props: Props): React.ReactElement {
const {
i18n,
conversationId,
disabled,
large,
inputApi,
@ -103,6 +106,7 @@ export function CompositionInput(props: Props): React.ReactElement {
draftBodyRanges,
getQuotedMessage,
clearQuotedMessage,
scrollToBottom,
sortedGroupMembers,
} = props;
@ -238,6 +242,7 @@ export function CompositionInput(props: Props): React.ReactElement {
`CompositionInput: Submitting message ${timestamp} with ${mentions.length} mentions`
);
onSubmit(text, mentions, timestamp);
scrollToBottom(conversationId);
};
if (inputApi) {