Skip to content

Commit

Permalink
Merge pull request Expensify#35594 from Tony-MK/fix/33976
Browse files Browse the repository at this point in the history
Fix/33976: Workspace name in request flow is wrong color and navigating back
  • Loading branch information
dangrous authored Feb 14, 2024
2 parents 41237e3 + 4b15c17 commit 0e419dd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/ROUTES.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ const ROUTES = {
},
REPORT_WITH_ID_DETAILS: {
route: 'r/:reportID/details',
getRoute: (reportID: string) => `r/${reportID}/details` as const,
getRoute: (reportID: string, backTo?: string) => getUrlWithBackToParam(`r/${reportID}/details`, backTo),
},
REPORT_SETTINGS: {
route: 'r/:reportID/settings',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
} else {
const formattedSelectedParticipants = _.map(selectedParticipants, (participant) => ({
...participant,
isDisabled: ReportUtils.isOptimisticPersonalDetail(participant.accountID),
isDisabled: !participant.isPolicyExpenseChat && ReportUtils.isOptimisticPersonalDetail(participant.accountID),
}));
sections.push({
title: translate('common.to'),
Expand Down Expand Up @@ -508,12 +508,12 @@ function MoneyTemporaryForRefactorRequestConfirmationList({
* @param {Object} option
*/
const navigateToReportOrUserDetail = (option) => {
if (option.accountID) {
const activeRoute = Navigation.getActiveRouteWithoutParams();
const activeRoute = Navigation.getActiveRouteWithoutParams();

if (option.accountID) {
Navigation.navigate(ROUTES.PROFILE.getRoute(option.accountID, activeRoute));
} else if (option.reportID) {
Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(option.reportID));
Navigation.navigate(ROUTES.REPORT_WITH_ID_DETAILS.getRoute(option.reportID, activeRoute));
}
};

Expand Down
9 changes: 4 additions & 5 deletions src/pages/ReportDetailsPage.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import {useRoute} from '@react-navigation/native';
import type {StackScreenProps} from '@react-navigation/stack';
import React, {useEffect, useMemo} from 'react';
import {ScrollView, View} from 'react-native';
Expand Down Expand Up @@ -60,6 +61,7 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
const {translate} = useLocalize();
const {isOffline} = useNetwork();
const styles = useThemeStyles();
const route = useRoute();
const policy = useMemo(() => policies?.[`${ONYXKEYS.COLLECTION.POLICY}${report?.policyID ?? ''}`], [policies, report?.policyID]);
const isPolicyAdmin = useMemo(() => PolicyUtils.isPolicyAdmin(policy ?? null), [policy]);
const isPolicyMember = useMemo(() => PolicyUtils.isPolicyMember(report?.policyID ?? '', policies), [report?.policyID, policies]);
Expand Down Expand Up @@ -184,11 +186,8 @@ function ReportDetailsPage({policies, report, session, personalDetails}: ReportD
<FullPageNotFoundView shouldShow={isEmptyObject(report)}>
<HeaderWithBackButton
title={translate('common.details')}
shouldNavigateToTopMostReport
onBackButtonPress={() => {
Navigation.goBack();
Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(report?.reportID ?? ''));
}}
onBackButtonPress={Navigation.goBack}
shouldNavigateToTopMostReport={!(route.params && 'backTo' in route.params)}
/>
<ScrollView style={[styles.flex1]}>
<View style={styles.reportDetailsTitleContainer}>
Expand Down

0 comments on commit 0e419dd

Please sign in to comment.