Skip to content

Commit 5b5c2ac

Browse files
authored
Access to message list onScroll event and custom new message notification (#442)
1 parent 6b7fd59 commit 5b5c2ac

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/components/MessageList/MessageList.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ import {
1212
DateSeparatorProps,
1313
DateSeparator as DefaultDateSeparator,
1414
} from './DateSeparator';
15-
import { MessageNotification } from './MessageNotification';
15+
import {
16+
MessageNotification as DefaultMessageNotification,
17+
MessageNotificationProps,
18+
} from './MessageNotification';
1619
import {
1720
MessageSystem as DefaultMessageSystem,
1821
MessageSystemProps,
@@ -171,6 +174,7 @@ export type MessageListProps<
171174
* If all the actions need to be disabled, empty array or false should be provided as value of prop.
172175
*/
173176
messageActions?: boolean | string[];
177+
MessageNotification?: React.ComponentType<MessageNotificationProps>;
174178
/**
175179
* Custom UI component to display a system message
176180
* Default component (accepts the same props): [MessageSystem](https://getstream.github.io/stream-chat-react-native/#messagesystem)
@@ -180,6 +184,7 @@ export type MessageListProps<
180184
>;
181185
/** Turn off grouping of messages by user */
182186
noGroupByUser?: boolean;
187+
onListScroll?: ScrollViewProps['onScroll'];
183188
/**
184189
* Handler to open the thread on message. This is callback for touch event for replies button.
185190
*
@@ -243,9 +248,11 @@ export const MessageList = <
243248
dismissKeyboardOnMessageTouch = true,
244249
HeaderComponent,
245250
Message: MessageFromProps,
251+
MessageNotification = DefaultMessageNotification,
246252
MessageSystem = DefaultMessageSystem,
247253
messageActions,
248254
noGroupByUser,
255+
onListScroll,
249256
onThreadSelect,
250257
setFlatListRef,
251258
threadList,
@@ -375,6 +382,9 @@ export const MessageList = <
375382
if (removeNewMessageNotification) {
376383
setNewMessageNotification(false);
377384
}
385+
if (onListScroll) {
386+
onListScroll(event);
387+
}
378388
};
379389

380390
const goToNewMessages = () => {

0 commit comments

Comments
 (0)