@@ -42,7 +42,6 @@ import {
4242 ThreadContextValue ,
4343 useThreadContext ,
4444} from '../../contexts/threadContext/ThreadContext' ;
45- import { useTranslationContext } from '../../contexts/translationContext/TranslationContext' ;
4645import { styled } from '../../styles/styledComponents' ;
4746
4847import type { UserResponse } from 'stream-chat' ;
@@ -61,20 +60,7 @@ import type {
6160 UnknownType ,
6261} from '../../types/types' ;
6362
64- const ErrorNotification = styled . View `
65- align-items: center;
66- background-color: #fae6e8;
67- color: red;
68- padding: 5px;
69- z-index: 10;
70- ${ ( { theme } ) => theme . messageList . errorNotification . css }
71- ` ;
72-
73- const ErrorNotificationText = styled . Text `
74- background-color: #fae6e8;
75- color: red;
76- ${ ( { theme } ) => theme . messageList . errorNotificationText . css }
77- ` ;
63+ import { NetworkDownIndicator as DefaultNetworkDownIndicator } from './NetworkDownIndicator' ;
7864
7965const ListContainer = ( styled ( FlatList ) `
8066 flex: 1;
@@ -185,6 +171,12 @@ export type MessageListProps<
185171 MessageSystem ?: React . ComponentType <
186172 MessageSystemProps < At , Ch , Co , Ev , Me , Re , Us >
187173 > ;
174+ /**
175+ * Custom UI component to render network down indicator
176+ *
177+ * Defaults to and accepts same props as: [NetworkDownIndicator](https://getstream.github.io/stream-chat-react-native/#NetworkDownIndicator)
178+ */
179+ NetworkDownIndicator ?: React . ComponentType ;
188180 /** Turn off grouping of messages by user */
189181 noGroupByUser ?: boolean ;
190182 onListScroll ?: ScrollViewProps [ 'onScroll' ] ;
@@ -261,6 +253,7 @@ export const MessageList = <
261253 onThreadSelect,
262254 setFlatListRef,
263255 threadList,
256+ NetworkDownIndicator = DefaultNetworkDownIndicator ,
264257 TypingIndicator = DefaultTypingIndicator ,
265258 } = props ;
266259
@@ -280,7 +273,6 @@ export const MessageList = <
280273 Message : MessageFromContext ,
281274 } = useMessagesContext < At , Ch , Co , Ev , Me , Re , Us > ( ) ;
282275 const { loadMoreThread } = useThreadContext < At , Ch , Co , Ev , Me , Re , Us > ( ) ;
283- const { t } = useTranslationContext ( ) ;
284276
285277 const messageList = useMessageList < At , Ch , Co , Ev , Me , Re , Us > ( {
286278 inverted,
@@ -455,13 +447,7 @@ export const MessageList = <
455447 showNotification = { newMessagesNotification }
456448 />
457449 ) }
458- { ! isOnline && (
459- < ErrorNotification testID = 'error-notification' >
460- < ErrorNotificationText >
461- { t ( 'Connection failure, reconnecting now ...' ) }
462- </ ErrorNotificationText >
463- </ ErrorNotification >
464- ) }
450+ { ! isOnline && < NetworkDownIndicator /> }
465451 </ View >
466452 {
467453 // Mask for edit state
0 commit comments