Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/components/Search/SearchList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ type SearchListProps = Pick<FlatListPropsWithLayout<SearchListItem>, '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(
Expand All @@ -80,6 +83,7 @@ function SearchList(
containerStyle,
ListFooterComponent,
shouldPreventDefaultFocusOnSelectRow,
shouldPreventLongPressRow,
}: SearchListProps,
ref: ForwardedRef<SearchListHandle>,
) {
Expand Down Expand Up @@ -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(() => {
Expand Down
1 change: 1 addition & 0 deletions src/components/Search/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 : (
<SearchTableHeader
Expand Down