diff --git a/src/components/Search/SearchList.tsx b/src/components/Search/SearchList.tsx index 60fa1d243b95..0ff09ffac782 100644 --- a/src/components/Search/SearchList.tsx +++ b/src/components/Search/SearchList.tsx @@ -62,6 +62,9 @@ type SearchListProps = Pick, 'onScroll' /** Whether to prevent default focusing of options and focus the textinput when selecting an option */ shouldPreventDefaultFocusOnSelectRow?: boolean; + + /** Whether to prevent long press of options */ + shouldPreventLongPressRow?: boolean; }; function SearchList( @@ -80,6 +83,7 @@ function SearchList( containerStyle, ListFooterComponent, shouldPreventDefaultFocusOnSelectRow, + shouldPreventLongPressRow, }: SearchListProps, ref: ForwardedRef, ) { @@ -143,13 +147,13 @@ function SearchList( const handleLongPressRow = useCallback( (item: SearchListItem) => { // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing - if (!isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox || !isFocused) { + if (shouldPreventLongPressRow || !isSmallScreenWidth || item?.isDisabled || item?.isDisabledCheckbox || !isFocused) { return; } setLongPressedItem(item); setIsModalVisible(true); }, - [isFocused, isSmallScreenWidth], + [isFocused, isSmallScreenWidth, shouldPreventLongPressRow], ); const turnOnSelectionMode = useCallback(() => { diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index 0cd193853414..bcceb984397e 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -454,6 +454,7 @@ function Search({queryJSON, currentSearchResults, lastNonEmptySearchResults, onS onCheckboxPress={toggleTransaction} onAllCheckboxPress={toggleAllTransactions} canSelectMultiple={type !== CONST.SEARCH.DATA_TYPES.CHAT && canSelectMultiple} + shouldPreventLongPressRow={isChat} SearchTableHeader={ !isLargeScreenWidth ? undefined : (