@@ -137,7 +137,6 @@ type MessageListPropsWithContext<
137137 | 'DateHeader'
138138 | 'disableTypingIndicator'
139139 | 'FlatList'
140- | 'initialScrollToFirstUnreadMessage'
141140 | 'InlineDateSeparator'
142141 | 'InlineUnreadIndicator'
143142 | 'legacyImageViewerSwipeBehaviour'
@@ -245,7 +244,6 @@ const MessageListWithContext = <
245244 HeaderComponent = LoadingMoreRecentIndicator ,
246245 hideStickyDateHeader,
247246 highlightedMessageId,
248- initialScrollToFirstUnreadMessage,
249247 InlineDateSeparator,
250248 InlineUnreadIndicator,
251249 inverted = true ,
@@ -350,11 +348,6 @@ const MessageListWithContext = <
350348 */
351349 const scrollToDebounceTimeoutRef = useRef < ReturnType < typeof setTimeout > > ( ) ;
352350
353- /**
354- * The timeout id used to lazier load the initial scroll set flag
355- */
356- const initialScrollSettingTimeoutRef = useRef < ReturnType < typeof setTimeout > > ( ) ;
357-
358351 /**
359352 * The timeout id used to temporarily load the initial scroll set flag
360353 */
@@ -579,7 +572,7 @@ const MessageListWithContext = <
579572 animated : true ,
580573 offset : 0 ,
581574 } ) ;
582- } , 150 ) ; // flatlist might take a bit to update, so a small delay is needed
575+ } , WAIT_FOR_SCROLL_TO_OFFSET_TIMEOUT ) ; // flatlist might take a bit to update, so a small delay is needed
583576 }
584577 }
585578 // eslint-disable-next-line react-hooks/exhaustive-deps
@@ -896,9 +889,6 @@ const MessageListWithContext = <
896889 */
897890 useEffect ( ( ) => {
898891 scrollToDebounceTimeoutRef . current = setTimeout ( async ( ) => {
899- if ( initialScrollToFirstUnreadMessage ) {
900- clearTimeout ( initialScrollSettingTimeoutRef . current ) ;
901- }
902892 const messageIdToScroll : string | undefined = targetedMessage ;
903893 if ( ! messageIdToScroll ) return ;
904894 const indexOfParentInMessageList = processedMessageList . findIndex (
@@ -923,10 +913,10 @@ const MessageListWithContext = <
923913 } ) ;
924914 setTargetedMessage ( undefined ) ;
925915 }
926- } , 50 ) ;
916+ } , WAIT_FOR_SCROLL_TO_OFFSET_TIMEOUT ) ;
927917
928918 // eslint-disable-next-line react-hooks/exhaustive-deps
929- } , [ targetedMessage , initialScrollToFirstUnreadMessage ] ) ;
919+ } , [ targetedMessage ] ) ;
930920
931921 const messagesWithImages =
932922 legacyImageViewerSwipeBehaviour &&
@@ -1209,7 +1199,6 @@ export const MessageList = <
12091199 DateHeader,
12101200 disableTypingIndicator,
12111201 FlatList,
1212- initialScrollToFirstUnreadMessage,
12131202 InlineDateSeparator,
12141203 InlineUnreadIndicator,
12151204 legacyImageViewerSwipeBehaviour,
@@ -1243,7 +1232,6 @@ export const MessageList = <
12431232 FlatList,
12441233 hideStickyDateHeader,
12451234 highlightedMessageId,
1246- initialScrollToFirstUnreadMessage,
12471235 InlineDateSeparator,
12481236 InlineUnreadIndicator,
12491237 isListActive : isChannelActive ,
0 commit comments