Skip to content

Commit 9e539e2

Browse files
authored
Merge pull request #950 from GetStream/VML-loadMore-prop
Add loadMore VML prop
2 parents 0741ce3 + c2e8c4e commit 9e539e2

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## [6.0.5](https://github.com/GetStream/stream-chat-react/releases/tag/v6.0.5) 2021-05-28
44

5+
### Feature
6+
7+
- Add optional prop to override default `loadMore` function in `VirtualizedMessageList` [#950](https://github.com/GetStream/stream-chat-react/pull/950)
8+
59
### Bug
610

711
- Prevent unnecessary members query when `disableMentions` is enabled on `MessageInput` [#949](https://github.com/GetStream/stream-chat-react/pull/949)

src/components/MessageList/VirtualizedMessageList.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ import { LoadingIndicator as DefaultLoadingIndicator } from '../Loading/LoadingI
2020
import { FixedHeightMessage, FixedHeightMessageProps } from '../Message/FixedHeightMessage';
2121
import { Message } from '../Message/Message';
2222

23-
import { useChannelActionContext } from '../../context/ChannelActionContext';
23+
import {
24+
ChannelActionContextValue,
25+
useChannelActionContext,
26+
} from '../../context/ChannelActionContext';
2427
import { StreamMessage, useChannelStateContext } from '../../context/ChannelStateContext';
2528
import { useChatContext } from '../../context/ChatContext';
2629
import { useComponentContext } from '../../context/ComponentContext';
@@ -53,7 +56,6 @@ type VirtualizedMessageListWithContextProps<
5356
client: StreamChat<At, Ch, Co, Ev, Me, Re, Us>;
5457
hasMore: boolean;
5558
loadingMore: boolean;
56-
loadMore: (messageLimit: number) => Promise<number>;
5759
};
5860

5961
const VirtualizedMessageListWithContext = <
@@ -300,6 +302,8 @@ export type VirtualizedMessageListProps<
300302
hideDeletedMessages?: boolean;
301303
/** Hides the `DateSeparator` component when new messages are received in a channel that's watched but not active, defaults to false */
302304
hideNewMessageSeparator?: boolean;
305+
/** Function called when more messages are to be loaded, defaults to function stored in [ChannelActionContext](https://getstream.github.io/stream-chat-react/#section-channelactioncontext) */
306+
loadMore?: ChannelActionContextValue['loadMore'];
303307
/** Custom UI component to display a message, defaults to and accepts same props as [FixedHeightMessage](https://github.com/GetStream/stream-chat-react/blob/master/src/components/Message/FixedHeightMessage.tsx) */
304308
Message?: React.ComponentType<FixedHeightMessageProps<At, Ch, Co, Ev, Me, Re, Us>>;
305309
/** Set the limit to use when paginating messages */

0 commit comments

Comments
 (0)