@@ -7,8 +7,8 @@ import type {LayoutChangeEvent, NativeScrollEvent, NativeSyntheticEvent} from 'r
77import { DeviceEventEmitter , InteractionManager , View } from 'react-native' ;
88import type { OnyxEntry } from 'react-native-onyx' ;
99import { renderScrollComponent as renderActionSheetAwareScrollView } from '@components/ActionSheetAwareScrollView' ;
10- import FlatList from '@components/FlatList' ;
1110import Button from '@components/Button' ;
11+ import FlatList from '@components/FlatList/FlatList' ;
1212import { usePersonalDetails } from '@components/OnyxListItemProvider' ;
1313import ReportActionsSkeletonView from '@components/ReportActionsSkeletonView' ;
1414import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails' ;
@@ -63,7 +63,6 @@ import {
6363import Visibility from '@libs/Visibility' ;
6464import type { ReportsSplitNavigatorParamList } from '@navigation/types' ;
6565import ConciergeThinkingMessage from '@pages/home/report/ConciergeThinkingMessage' ;
66- import { ActionListContext } from '@pages/inbox/ReportScreenContext' ;
6766import variables from '@styles/variables' ;
6867import { openReport , readNewestAction , subscribeToNewActionEvent } from '@userActions/Report' ;
6968import CONST from '@src/CONST' ;
@@ -75,7 +74,7 @@ import FloatingMessageCounter from './FloatingMessageCounter';
7574import getInitialNumToRender from './getInitialNumReportActionsToRender' ;
7675import ListBoundaryLoader from './ListBoundaryLoader' ;
7776import ReportActionsListItemRenderer from './ReportActionsListItemRenderer' ;
78- import shouldDisplayNewMarkerOnReportAction , { getUnreadMarkerReportAction } from './shouldDisplayNewMarkerOnReportAction' ;
77+ import shouldDisplayNewMarkerOnReportAction from './shouldDisplayNewMarkerOnReportAction' ;
7978import StaticReportActionsPreview from './StaticReportActionsPreview' ;
8079import useReportUnreadMessageScrollTracking from './useReportUnreadMessageScrollTracking' ;
8180
@@ -323,14 +322,15 @@ function ReportActionsList({
323322 unreadMarkerTime,
324323 scrollingVerticalOffset : scrollingVerticalOffset . current ,
325324 prevUnreadMarkerReportActionID : prevUnreadMarkerReportActionID . current ,
325+ isOffline,
326326 } ) ;
327327 if ( shouldDisplayNewMarker ) {
328328 return [ reportAction . reportActionID , index ] ;
329329 }
330330 }
331331
332332 return [ null , - 1 ] ;
333- } , [ currentUserAccountID , isAnonymousUser , earliestReceivedOfflineMessageIndex , prevSortedVisibleReportActionsObjects , sortedVisibleReportActions , unreadMarkerTime ] ) ;
333+ } , [ currentUserAccountID , isAnonymousUser , earliestReceivedOfflineMessageIndex , prevSortedVisibleReportActionsObjects , sortedVisibleReportActions , unreadMarkerTime , isOffline ] ) ;
334334 prevUnreadMarkerReportActionID . current = unreadMarkerReportActionID ;
335335
336336 /**
@@ -398,22 +398,9 @@ function ReportActionsList({
398398 hasOnceLoadedReportActions : ! ! reportMetadata ?. hasOnceLoadedReportActions ,
399399 } ) ;
400400
401- useEffect ( ( ) => {
402- if (
403- scrollingVerticalOffset . current < AUTOSCROLL_TO_TOP_THRESHOLD &&
404- previousLastIndex . current !== lastActionIndex &&
405- reportActionSize . current !== sortedVisibleReportActions . length &&
406- hasNewestReportAction
407- ) {
408- setIsFloatingMessageCounterVisible ( false ) ;
409- reportScrollManager . scrollToBottom ( ) ;
410- }
411- previousLastIndex . current = lastActionIndex ;
412- reportActionSize . current = sortedVisibleReportActions . length ;
413- } , [ lastActionIndex , sortedVisibleReportActions . length , reportScrollManager , hasNewestReportAction , linkedReportActionID , setIsFloatingMessageCounterVisible ] ) ;
414401 useScrollToEndOnNewMessageReceived ( {
415402 sizeChangeType : 'changed' ,
416- scrollOffsetRef,
403+ scrollOffsetRef : scrollingVerticalOffset ,
417404 lastActionID : lastAction ?. reportActionID ,
418405 visibleActionsLength : sortedVisibleReportActions . length ,
419406 hasNewestReportAction,
@@ -446,7 +433,7 @@ function ReportActionsList({
446433 // To handle this, we use the 'referrer' parameter to check if the current navigation is triggered from a notification.
447434 const isFromNotification = route ?. params ?. referrer === CONST . REFERRER . NOTIFICATION ;
448435 if ( ( isVisible || isFromNotification ) && scrollingVerticalOffset . current < CONST . REPORT . ACTIONS . ACTION_VISIBLE_THRESHOLD ) {
449- readNewestAction ( report . reportID ) ;
436+ readNewestAction ( report . reportID , ! ! reportMetadata ?. hasOnceLoadedReportActions ) ;
450437 if ( isFromNotification ) {
451438 Navigation . setParams ( { referrer : undefined } ) ;
452439 }
@@ -792,7 +779,6 @@ function ReportActionsList({
792779 styles ,
793780 translate ,
794781 expensifyIcons . UpArrow ,
795- isOffline ,
796782 ] ,
797783 ) ;
798784
0 commit comments