@@ -6,7 +6,7 @@ import {useOnyx} from 'react-native-onyx';
6
6
import FullPageErrorView from '@components/BlockingViews/FullPageErrorView' ;
7
7
import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView' ;
8
8
import SearchTableHeader from '@components/SelectionList/SearchTableHeader' ;
9
- import type { ReportActionListItemType , ReportListItemType , TransactionListItemType } from '@components/SelectionList/types' ;
9
+ import type { ReportActionListItemType , ReportListItemType , SearchListItem , TransactionListItemType } from '@components/SelectionList/types' ;
10
10
import SearchRowSkeleton from '@components/Skeletons/SearchRowSkeleton' ;
11
11
import useLocalize from '@hooks/useLocalize' ;
12
12
import useMobileSelectionMode from '@hooks/useMobileSelectionMode' ;
@@ -32,6 +32,7 @@ import {
32
32
isReportListItemType ,
33
33
isSearchDataLoaded ,
34
34
isSearchResultsEmpty as isSearchResultsEmptyUtil ,
35
+ isTaskListItemType ,
35
36
isTransactionListItemType ,
36
37
shouldShowEmptyState ,
37
38
shouldShowYear as shouldShowYearUtil ,
@@ -78,12 +79,14 @@ function mapToTransactionItemWithSelectionInfo(item: TransactionListItemType, se
78
79
return { ...item , shouldAnimateInHighlight, isSelected : selectedTransactions [ item . keyForList ] ?. isSelected && canSelectMultiple } ;
79
80
}
80
81
81
- function mapToItemWithSelectionInfo (
82
- item : TransactionListItemType | ReportListItemType | ReportActionListItemType ,
83
- selectedTransactions : SelectedTransactions ,
84
- canSelectMultiple : boolean ,
85
- shouldAnimateInHighlight : boolean ,
86
- ) {
82
+ function mapToItemWithSelectionInfo ( item : SearchListItem , selectedTransactions : SelectedTransactions , canSelectMultiple : boolean , shouldAnimateInHighlight : boolean ) {
83
+ if ( isTaskListItemType ( item ) ) {
84
+ return {
85
+ ...item ,
86
+ shouldAnimateInHighlight,
87
+ } ;
88
+ }
89
+
87
90
if ( isReportActionListItemType ( item ) ) {
88
91
return {
89
92
...item ,
@@ -158,7 +161,6 @@ function Search({queryJSON, currentSearchResults, lastNonEmptySearchResults, onS
158
161
const shouldGroupByReports = groupBy === CONST . SEARCH . GROUP_BY . REPORTS ;
159
162
160
163
const { canUseTableReportView} = usePermissions ( ) ;
161
- const canSelectMultiple = isSmallScreenWidth ? ! ! selectionMode ?. isEnabled : true ;
162
164
163
165
useEffect ( ( ) => {
164
166
clearSelectedTransactions ( hash ) ;
@@ -327,7 +329,7 @@ function Search({queryJSON, currentSearchResults, lastNonEmptySearchResults, onS
327
329
} , [ isFocused , data , searchResults ?. search ?. hasMoreResults , selectedTransactions , setExportMode , setShouldShowExportModeOption , shouldGroupByReports ] ) ;
328
330
329
331
const openReport = useCallback (
330
- ( item : TransactionListItemType | ReportListItemType | ReportActionListItemType , isOpenedAsReport ?: boolean ) => {
332
+ ( item : SearchListItem , isOpenedAsReport ?: boolean ) => {
331
333
const isFromSelfDM = item . reportID === CONST . REPORT . UNREPORTED_REPORTID ;
332
334
const isTransactionItem = isTransactionListItemType ( item ) ;
333
335
@@ -407,7 +409,11 @@ function Search({queryJSON, currentSearchResults, lastNonEmptySearchResults, onS
407
409
408
410
const ListItem = getListItem ( type , status , shouldGroupByReports ) ;
409
411
const sortedData = getSortedSections ( type , status , data , sortBy , sortOrder , shouldGroupByReports ) ;
412
+
410
413
const isChat = type === CONST . SEARCH . DATA_TYPES . CHAT ;
414
+ const isTask = type === CONST . SEARCH . DATA_TYPES . TASK ;
415
+ const canSelectMultiple = ! isChat && ! isTask && isLargeScreenWidth ;
416
+
411
417
const sortedSelectedData = sortedData . map ( ( item ) => {
412
418
const baseKey = isChat
413
419
? `${ ONYXKEYS . COLLECTION . REPORT_ACTIONS } ${ ( item as ReportActionListItemType ) . reportActionID } `
@@ -453,10 +459,13 @@ function Search({queryJSON, currentSearchResults, lastNonEmptySearchResults, onS
453
459
) ;
454
460
}
455
461
456
- const toggleTransaction = ( item : TransactionListItemType | ReportListItemType | ReportActionListItemType ) => {
462
+ const toggleTransaction = ( item : SearchListItem ) => {
457
463
if ( isReportActionListItemType ( item ) ) {
458
464
return ;
459
465
}
466
+ if ( isTaskListItemType ( item ) ) {
467
+ return ;
468
+ }
460
469
if ( isTransactionListItemType ( item ) ) {
461
470
if ( ! item . keyForList ) {
462
471
return ;
@@ -518,6 +527,7 @@ function Search({queryJSON, currentSearchResults, lastNonEmptySearchResults, onS
518
527
519
528
const shouldShowYear = shouldShowYearUtil ( searchResults ?. data ) ;
520
529
const shouldShowSorting = ! Array . isArray ( status ) && ! shouldGroupByReports ;
530
+ const shouldShowTableHeader = isLargeScreenWidth && ! isChat ;
521
531
522
532
return (
523
533
< SearchScopeProvider isOnSearch >
@@ -528,11 +538,12 @@ function Search({queryJSON, currentSearchResults, lastNonEmptySearchResults, onS
528
538
onSelectRow = { openReport }
529
539
onCheckboxPress = { toggleTransaction }
530
540
onAllCheckboxPress = { toggleAllTransactions }
531
- canSelectMultiple = { type !== CONST . SEARCH . DATA_TYPES . CHAT && canSelectMultiple }
541
+ canSelectMultiple = { canSelectMultiple }
532
542
shouldPreventLongPressRow = { isChat }
533
543
SearchTableHeader = {
534
- ! isLargeScreenWidth ? undefined : (
544
+ ! shouldShowTableHeader ? undefined : (
535
545
< SearchTableHeader
546
+ canSelectMultiple = { canSelectMultiple }
536
547
data = { searchResults ?. data }
537
548
metadata = { searchResults ?. search }
538
549
onSortPress = { onSortPress }
0 commit comments