Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions src/pages/home/report/ReportActionsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,8 @@ function ReportActionsList({
const [accountID] = useOnyx(ONYXKEYS.SESSION, {selector: (session) => session?.accountID});
const participantsContext = useContext(PersonalDetailsContext);

const [isScrollToBottomEnabled, setIsScrollToBottomEnabled] = useState(false);

useEffect(() => {
const unsubscriber = Visibility.onVisibilityChange(() => {
setIsVisible(Visibility.isVisible());
Expand Down Expand Up @@ -458,10 +460,11 @@ function ReportActionsList({
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report.reportID));
return;
}
reportScrollManager.scrollToBottom();

setIsScrollToBottomEnabled(true);
});
},
[reportScrollManager, report.reportID],
[report.reportID],
);
useEffect(() => {
// Why are we doing this, when in the cleanup of the useEffect we are already calling the unsubscribe function?
Expand Down Expand Up @@ -667,8 +670,12 @@ function ReportActionsList({
const onLayoutInner = useCallback(
(event: LayoutChangeEvent) => {
onLayout(event);
if (isScrollToBottomEnabled) {
reportScrollManager.scrollToBottom();
setIsScrollToBottomEnabled(false);
}
},
[onLayout],
[isScrollToBottomEnabled, onLayout, reportScrollManager],
);
const onContentSizeChangeInner = useCallback(
(w: number, h: number) => {
Expand Down
Loading