Skip to content

Commit

Permalink
Merge pull request #52160 from nyomanjyotisa/issue-51476
Browse files Browse the repository at this point in the history
Fix: Inconsistency in displaying Search icon when returning to expenses opened from Search
  • Loading branch information
marcochavezf authored Nov 7, 2024
2 parents 1e64035 + 7f51fdc commit 494211d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/MoneyReportHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function MoneyReportHeader({policy, report: moneyRequestReport, transactionThrea
const [isNoDelegateAccessMenuVisible, setIsNoDelegateAccessMenuVisible] = useState(false);

const isReportInRHP = isReportOpenInRHP(navigationRef?.getRootState());
const shouldDisplaySearchRouter = !isReportInRHP;
const shouldDisplaySearchRouter = !isReportInRHP || isSmallScreenWidth;

const confirmPayment = useCallback(
(type?: PaymentMethodType | undefined, payAsBusiness?: boolean) => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/MoneyRequestHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function MoneyRequestHeader({report, parentReportAction, policy, onBackButtonPre
const reportID = report?.reportID;

const isReportInRHP = isReportOpenInRHP(navigationRef?.getRootState());
const shouldDisplaySearchRouter = !isReportInRHP;
const shouldDisplaySearchRouter = !isReportInRHP || isSmallScreenWidth;

const hasAllPendingRTERViolations = TransactionUtils.allHavePendingRTERViolation([transaction?.transactionID ?? '-1']);

Expand Down
5 changes: 4 additions & 1 deletion src/pages/home/HeaderView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import Text from '@components/Text';
import Tooltip from '@components/Tooltip';
import useLocalize from '@hooks/useLocalize';
import usePolicy from '@hooks/usePolicy';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import isReportOpenInRHP from '@libs/Navigation/isReportOpenInRHP';
Expand Down Expand Up @@ -64,6 +65,8 @@ const fallbackIcon: IconType = {
};

function HeaderView({report, parentReportAction, reportID, onNavigationMenuButtonClicked, shouldUseNarrowLayout = false}: HeaderViewProps) {
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {isSmallScreenWidth} = useResponsiveLayout();
const [isDeleteTaskConfirmModalVisible, setIsDeleteTaskConfirmModalVisible] = React.useState(false);
const [invoiceReceiverPolicy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${report?.invoiceReceiver && 'policyID' in report.invoiceReceiver ? report.invoiceReceiver.policyID : -1}`);
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
Expand Down Expand Up @@ -145,7 +148,7 @@ function HeaderView({report, parentReportAction, reportID, onNavigationMenuButto
const isLoading = !report?.reportID || !title;

const isReportInRHP = isReportOpenInRHP(navigationRef?.getRootState());
const shouldDisplaySearchRouter = !isReportInRHP;
const shouldDisplaySearchRouter = !isReportInRHP || isSmallScreenWidth;
const isChatUsedForOnboarding = ReportUtils.isChatUsedForOnboarding(report);

return (
Expand Down

0 comments on commit 494211d

Please sign in to comment.