From 5f1a9bed742eac484bcba1e3b57531ceeb90706c Mon Sep 17 00:00:00 2001 From: Mateusz Titz Date: Mon, 17 Jun 2024 11:39:13 +0200 Subject: [PATCH] Add small fixes to search --- src/components/Search.tsx | 3 ++- src/libs/SearchUtils.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/Search.tsx b/src/components/Search.tsx index c885b6631d05..e4faa15bfb94 100644 --- a/src/components/Search.tsx +++ b/src/components/Search.tsx @@ -39,6 +39,7 @@ const sortableSearchTabs: SearchQuery[] = [CONST.TAB_SEARCH.ALL]; const transactionItemMobileHeight = 100; const reportItemTransactionHeight = 52; const listItemPadding = 12; // this is equivalent to 'mb3' on every transaction/report list item +const searchHeaderHeight = 54; function isTransactionListItemType(item: TransactionListItemType | ReportListItemType): item is TransactionListItemType { const transactionListItem = item as TransactionListItemType; @@ -162,7 +163,7 @@ function Search({query, policyIDs, sortBy, sortOrder}: SearchProps) { shouldShowYear={shouldShowYear} /> } - customListHeaderHeight={54} + customListHeaderHeight={searchHeaderHeight} // To enhance the smoothness of scrolling and minimize the risk of encountering blank spaces during scrolling, // we have configured a larger windowSize and a longer delay between batch renders. // The windowSize determines the number of items rendered before and after the currently visible items. diff --git a/src/libs/SearchUtils.ts b/src/libs/SearchUtils.ts index 4be04ac48802..a47915e3bf35 100644 --- a/src/libs/SearchUtils.ts +++ b/src/libs/SearchUtils.ts @@ -199,7 +199,7 @@ function getReportSections(data: OnyxTypes.SearchResults['data']): ReportListIte } } - return Object.values(reportIDToTransactions); + return Object.values(reportIDToTransactions).filter((item) => item.transactions?.length !== 0); } const searchTypeToItemMap: SearchTypeToItemMap = {