Skip to content

Commit

Permalink
Merge pull request #42239 from bernhardoj/fix/41514-back-nav-loop-fro…
Browse files Browse the repository at this point in the history
…m-details-page

Fix go back from details page remove the linked report action
  • Loading branch information
Hayata Suenaga committed Jun 5, 2024
2 parents 5af27bb + 6a03051 commit 952d844
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
10 changes: 1 addition & 9 deletions src/pages/FlagCommentPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import * as ReportUtils from '@libs/ReportUtils';
import * as Report from '@userActions/Report';
import * as Session from '@userActions/Session';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import type SCREENS from '@src/SCREENS';
import type * as OnyxTypes from '@src/types/onyx';
import withReportAndReportActionOrNotFound from './home/report/withReportAndReportActionOrNotFound';
Expand Down Expand Up @@ -160,14 +159,7 @@ function FlagCommentPage({parentReportAction, route, report, parentReport, repor
>
{({safeAreaPaddingBottomStyle}) => (
<FullPageNotFoundView shouldShow={!ReportUtils.shouldShowFlagComment(getActionToFlag(), report)}>
<HeaderWithBackButton
title={translate('reportActionContextMenu.flagAsOffensive')}
shouldNavigateToTopMostReport
onBackButtonPress={() => {
Navigation.goBack();
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report?.reportID ?? ''));
}}
/>
<HeaderWithBackButton title={translate('reportActionContextMenu.flagAsOffensive')} />
<ScrollView
contentContainerStyle={safeAreaPaddingBottomStyle}
style={styles.settingsPageBackground}
Expand Down
8 changes: 1 addition & 7 deletions src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import {useRoute} from '@react-navigation/native';
import type {StackScreenProps} from '@react-navigation/stack';
import React, {useCallback, useEffect, useMemo, useState} from 'react';
import {View} from 'react-native';
Expand Down Expand Up @@ -66,7 +65,6 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
const {translate} = useLocalize();
const {isOffline} = useNetwork();
const styles = useThemeStyles();
const route = useRoute();
const [isLastMemberLeavingGroupModalVisible, setIsLastMemberLeavingGroupModalVisible] = useState(false);
const policy = useMemo(() => policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID ?? ''}`], [policies, report?.policyID]);
const isPolicyAdmin = useMemo(() => PolicyUtils.isPolicyAdmin(policy ?? null), [policy]);
Expand Down Expand Up @@ -312,11 +310,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
return (
<ScreenWrapper testID={ReportDetailsPage.displayName}>
<FullPageNotFoundView shouldShow={isEmptyObject(report)}>
<HeaderWithBackButton
title={translate('common.details')}
onBackButtonPress={Navigation.goBack}
shouldNavigateToTopMostReport={!(route.params && 'backTo' in route.params)}
/>
<HeaderWithBackButton title={translate('common.details')} />
<ScrollView style={[styles.flex1]}>
<View style={styles.reportDetailsTitleContainer}>
{renderedAvatar}
Expand Down

0 comments on commit 952d844

Please sign in to comment.