Skip to content

Commit

Permalink
fix: scroll to bottom when bubble TypingIndicator appears (#1289)
Browse files Browse the repository at this point in the history
[CLNP-6036](https://sendbird.atlassian.net/browse/CLNP-6036)

### Issue
* Bubble type typing indicator appears but scroll doesn't move to the
bottom. So users can't see the appeared typing indicator.

### ChangeLog
* Fixed an issue where the typing indicator for bubble type messages
appeared but was not visible because the scroll did not move to the
bottom.
  • Loading branch information
HoonBaek authored Dec 19, 2024
1 parent 0ccfe17 commit 146ba9c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/modules/GroupChannel/components/MessageList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { GroupChannelUIBasicProps } from '../GroupChannelUI/GroupChannelUIView';
import { deleteNullish } from '../../../../utils/utils';
import { getMessagePartsInfo } from './getMessagePartsInfo';
import { MessageProvider } from '../../../Message/context/MessageProvider';
import { getComponentKeyFromMessage } from '../../context/utils';
import { getComponentKeyFromMessage, isContextMenuClosed } from '../../context/utils';
import { InfiniteList } from './InfiniteList';

export interface GroupChannelMessageListProps {
Expand Down Expand Up @@ -225,13 +225,20 @@ export const MessageList = (props: GroupChannelMessageListProps) => {

const TypingIndicatorBubbleWrapper = (props: { handleScroll: () => void; channelUrl: string }) => {
const { stores } = useSendbirdStateContext();
const { isScrollBottomReached, scrollPubSub } = useGroupChannelContext();
const [typingMembers, setTypingMembers] = useState<Member[]>([]);

useGroupChannelHandler(stores.sdkStore.sdk, {
onTypingStatusUpdated(channel) {
if (channel.url === props.channelUrl) {
setTypingMembers(channel.getTypingUsers());
}

if (isScrollBottomReached && isContextMenuClosed()) {
setTimeout(() => {
scrollPubSub.publish('scrollToBottom', {});
}, 10);
}
},
});

Expand Down

0 comments on commit 146ba9c

Please sign in to comment.