Skip to content

Commit 5249e91

Browse files
authored
Merge pull request Expensify#66105 from dmkt9/fix/65594
2 parents 0d7b280 + ff096c9 commit 5249e91

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

src/pages/home/report/ReportActionsList.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@ function ReportActionsList({
411411
const scrollToBottomForCurrentUserAction = useCallback(
412412
(isFromCurrentUser: boolean) => {
413413
InteractionManager.runAfterInteractions(() => {
414-
setIsFloatingMessageCounterVisible(false);
415414
// If a new comment is added and it's from the current user scroll to the bottom otherwise leave the user positioned where
416415
// they are now in the list.
417416
if (!isFromCurrentUser || (!isReportTopmostSplitNavigator() && !Navigation.getReportRHPActiveRoute())) {
@@ -427,6 +426,7 @@ function ReportActionsList({
427426
return;
428427
}
429428

429+
setIsFloatingMessageCounterVisible(false);
430430
reportScrollManager.scrollToBottom();
431431
setIsScrollToBottomEnabled(true);
432432
});
@@ -726,6 +726,9 @@ function ReportActionsList({
726726
key={listID}
727727
shouldEnableAutoScrollToTopThreshold={shouldEnableAutoScrollToTopThreshold}
728728
initialScrollKey={reportActionID}
729+
onContentSizeChange={() => {
730+
trackVerticalScrolling(undefined);
731+
}}
729732
/>
730733
</View>
731734
</>

src/pages/home/report/useReportUnreadMessageScrollTracking.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {useState} from 'react';
2-
import type {MutableRefObject} from 'react';
2+
import type {RefObject} from 'react';
33
import type {NativeScrollEvent, NativeSyntheticEvent} from 'react-native';
44
import {readNewestAction} from '@userActions/Report';
55
import CONST from '@src/CONST';
@@ -9,10 +9,10 @@ type Args = {
99
reportID: string;
1010

1111
/** The current offset of scrolling from either top or bottom of chat list */
12-
currentVerticalScrollingOffsetRef: MutableRefObject<number>;
12+
currentVerticalScrollingOffsetRef: RefObject<number>;
1313

1414
/** Ref for whether read action was skipped */
15-
readActionSkippedRef: MutableRefObject<boolean>;
15+
readActionSkippedRef: RefObject<boolean>;
1616

1717
/** The initial value for visibility of floating message button */
1818
floatingMessageVisibleInitialValue: boolean;
@@ -39,8 +39,10 @@ export default function useReportUnreadMessageScrollTracking({
3939
* Show/hide the new floating message counter when user is scrolling back/forth in the history of messages.
4040
* Call any other callback that the component might need
4141
*/
42-
const trackVerticalScrolling = (event: NativeSyntheticEvent<NativeScrollEvent>) => {
43-
onTrackScrolling(event);
42+
const trackVerticalScrolling = (event: NativeSyntheticEvent<NativeScrollEvent> | undefined) => {
43+
if (event) {
44+
onTrackScrolling(event);
45+
}
4446

4547
// display floating button if we're scrolled more than the offset
4648
if (currentVerticalScrollingOffsetRef.current > CONST.REPORT.ACTIONS.SCROLL_VERTICAL_OFFSET_THRESHOLD && !isFloatingMessageCounterVisible && hasUnreadMarkerReportAction) {

0 commit comments

Comments
 (0)