diff --git a/src/components/Search/index.tsx b/src/components/Search/index.tsx index ea87d595b9652..561b928ab1a27 100644 --- a/src/components/Search/index.tsx +++ b/src/components/Search/index.tsx @@ -146,7 +146,7 @@ function Search({queryJSON, onSearchListScroll, isSearchScreenFocused, contentCo lastSearchType, setLastSearchType, } = useSearchContext(); - const {selectionMode} = useMobileSelectionMode(false); + const {selectionMode} = useMobileSelectionMode(); const [offset, setOffset] = useState(0); const {type, status, sortBy, sortOrder, hash} = queryJSON; @@ -509,7 +509,6 @@ function Search({queryJSON, onSearchListScroll, isSearchScreenFocused, contentCo ? item.transactions.some((transaction) => selectedTransactions[transaction.keyForList]?.isSelected) : !!item.isSelected } - shouldAutoTurnOff={false} onScroll={onSearchListScroll} onContentSizeChange={onContentSizeChange} canSelectMultiple={type !== CONST.SEARCH.DATA_TYPES.CHAT && canSelectMultiple} diff --git a/src/components/SelectionListWithModal/index.tsx b/src/components/SelectionListWithModal/index.tsx index 81afd267abeae..412fc063a0afb 100644 --- a/src/components/SelectionListWithModal/index.tsx +++ b/src/components/SelectionListWithModal/index.tsx @@ -15,13 +15,12 @@ import CONST from '@src/CONST'; type SelectionListWithModalProps = BaseSelectionListProps & { turnOnSelectionModeOnLongPress?: boolean; onTurnOnSelectionMode?: (item: TItem | null) => void; - shouldAutoTurnOff?: boolean; isSelected?: (item: TItem) => boolean; isScreenFocused?: boolean; }; function SelectionListWithModal( - {turnOnSelectionModeOnLongPress, onTurnOnSelectionMode, onLongPressRow, isScreenFocused = false, sections, shouldAutoTurnOff, isSelected, ...rest}: SelectionListWithModalProps, + {turnOnSelectionModeOnLongPress, onTurnOnSelectionMode, onLongPressRow, isScreenFocused = false, sections, isSelected, ...rest}: SelectionListWithModalProps, ref: ForwardedRef, ) { const [isModalVisible, setIsModalVisible] = useState(false); @@ -33,7 +32,7 @@ function SelectionListWithModal( const {isSmallScreenWidth} = useResponsiveLayout(); const isFocused = useIsFocused(); - const {selectionMode} = useMobileSelectionMode(shouldAutoTurnOff); + const {selectionMode} = useMobileSelectionMode(); // Check if selection should be on when the modal is opened const wasSelectionOnRef = useRef(false); // Keep track of the number of selected items to determine if we should turn off selection mode diff --git a/src/hooks/useMobileSelectionMode.ts b/src/hooks/useMobileSelectionMode.ts index 0f2fcb9558f7e..8004d3674b3f2 100644 --- a/src/hooks/useMobileSelectionMode.ts +++ b/src/hooks/useMobileSelectionMode.ts @@ -3,15 +3,12 @@ import {useOnyx} from 'react-native-onyx'; import {turnOffMobileSelectionMode} from '@libs/actions/MobileSelectionMode'; import ONYXKEYS from '@src/ONYXKEYS'; -export default function useMobileSelectionMode(shouldAutoTurnOff = true) { +export default function useMobileSelectionMode() { const [selectionMode] = useOnyx(ONYXKEYS.MOBILE_SELECTION_MODE); useEffect(() => { - if (!shouldAutoTurnOff) { - return; - } turnOffMobileSelectionMode(); - }, [shouldAutoTurnOff]); + }, []); return {selectionMode}; }