Skip to content

Commit

Permalink
fix: navigate back if last route is add attachment
Browse files Browse the repository at this point in the history
  • Loading branch information
chrispader committed Mar 7, 2025
1 parent 7c4a9a6 commit 1d90859
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type {Attachment} from '@components/Attachments/types';
import validateAttachmentFile from '@libs/AttachmentUtils';
import ComposerFocusManager from '@libs/ComposerFocusManager';

Check failure on line 7 in src/pages/media/AttachmentModalScreen/routes/ReportAttachmentModalContent.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'ComposerFocusManager' is defined but never used
import {translateLocal} from '@libs/Localize';
import Navigation from '@libs/Navigation/Navigation';
import Navigation, {navigationRef} from '@libs/Navigation/Navigation';

Check failure on line 9 in src/pages/media/AttachmentModalScreen/routes/ReportAttachmentModalContent.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'navigationRef' is defined but never used
import type {AttachmentModalBaseContentProps} from '@pages/media/AttachmentModalScreen/AttachmentModalBaseContent';
import AttachmentModalContainer from '@pages/media/AttachmentModalScreen/AttachmentModalContainer';
import type {FileObject} from '@pages/media/AttachmentModalScreen/types';
Expand Down Expand Up @@ -228,11 +228,13 @@ function ReportAttachmentModalContent({
return;
}

if (reportID) {
Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(reportID));
} else {
Navigation.goBack(ROUTES.HOME);
}
Navigation.isNavigationReady().then(() => {
if (reportID) {
Navigation.goBack(ROUTES.REPORT_WITH_ID.getRoute(reportID));
} else {
Navigation.goBack(ROUTES.HOME);
}
});
}, [sourceParam, reportID, route.name, fileParam]);

return (
Expand Down

0 comments on commit 1d90859

Please sign in to comment.