diff --git a/src/pages/PrivateNotes/PrivateNotesEditPage.js b/src/pages/PrivateNotes/PrivateNotesEditPage.js index 3b94b7859f92..1061d334e686 100644 --- a/src/pages/PrivateNotes/PrivateNotesEditPage.js +++ b/src/pages/PrivateNotes/PrivateNotesEditPage.js @@ -92,7 +92,7 @@ function PrivateNotesEditPage({route, personalDetailsList, session, report}) { Keyboard.dismiss(); // Take user back to the PrivateNotesView page - Navigation.goBack(ROUTES.HOME); + Navigation.goBack(ROUTES.PRIVATE_NOTES_VIEW.getRoute(report.reportID, route.params.accountID)); }; return ( @@ -114,6 +114,7 @@ function PrivateNotesEditPage({route, personalDetailsList, session, report}) { Navigation.goBack(ROUTES.PRIVATE_NOTES_VIEW.getRoute(report.repotID, route.params.accountID))} shouldShowBackButton onCloseButtonPress={() => Navigation.dismissModal()} /> diff --git a/src/pages/PrivateNotes/PrivateNotesViewPage.js b/src/pages/PrivateNotes/PrivateNotesViewPage.js index 4d79f7815ff9..6550c9d7d3c3 100644 --- a/src/pages/PrivateNotes/PrivateNotesViewPage.js +++ b/src/pages/PrivateNotes/PrivateNotesViewPage.js @@ -56,6 +56,16 @@ function PrivateNotesViewPage({route, personalDetailsList, session, report}) { const isCurrentUserNote = Number(session.accountID) === Number(route.params.accountID); const privateNote = lodashGet(report, ['privateNotes', route.params.accountID, 'note'], ''); + const getFallbackRoute = () => { + const privateNotes = lodashGet(report, 'privateNotes', {}); + + if (_.keys(privateNotes).length === 1) { + return ROUTES.HOME; + } + + return ROUTES.PRIVATE_NOTES_LIST.getRoute(report.reportID); + }; + return ( Navigation.goBack(getFallbackRoute())} subtitle={isCurrentUserNote ? translate('privateNotes.myNote') : `${lodashGet(personalDetailsList, [route.params.accountID, 'login'], '')} note`} shouldShowBackButton onCloseButtonPress={() => Navigation.dismissModal()}