From 1ef6f75d96cb2c4ea2d3b952afb1485ff7486ca0 Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 20 May 2024 16:43:17 +0700 Subject: [PATCH 1/5] fix User has to click twice to select currency --- src/components/SelectionList/BaseListItem.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SelectionList/BaseListItem.tsx b/src/components/SelectionList/BaseListItem.tsx index 5876e476afa2..329cd6504f17 100644 --- a/src/components/SelectionList/BaseListItem.tsx +++ b/src/components/SelectionList/BaseListItem.tsx @@ -78,7 +78,7 @@ function BaseListItem({ hoverDimmingValue={1} hoverStyle={[!item.isDisabled && styles.hoveredComponentBG, hoverStyle]} dataSet={{[CONST.SELECTION_SCRAPER_HIDDEN_ELEMENT]: true}} - onMouseDown={shouldPreventDefaultFocusOnSelectRow ? (e) => e.preventDefault() : undefined} + onMouseDown={(e) => e.preventDefault()} id={keyForList ?? ''} style={pressableStyle} onFocus={onFocus} From 26fbf601f003672cb06e6b37de012850c33d67d9 Mon Sep 17 00:00:00 2001 From: tienifr Date: Mon, 20 May 2024 17:00:42 +0700 Subject: [PATCH 2/5] fix lint --- src/components/SelectionList/BaseListItem.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/SelectionList/BaseListItem.tsx b/src/components/SelectionList/BaseListItem.tsx index 329cd6504f17..526262870f56 100644 --- a/src/components/SelectionList/BaseListItem.tsx +++ b/src/components/SelectionList/BaseListItem.tsx @@ -17,7 +17,6 @@ function BaseListItem({ wrapperStyle, containerStyle, isDisabled = false, - shouldPreventDefaultFocusOnSelectRow = false, shouldPreventEnterKeySubmit = false, canSelectMultiple = false, onSelectRow, From 55d5deda8025c7371aa42a800c946e585831162a Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 7 Jun 2024 15:46:45 +0700 Subject: [PATCH 3/5] fix remove used prop --- src/components/SelectionList/InviteMemberListItem.tsx | 1 - src/components/SelectionList/RadioListItem.tsx | 1 - src/components/SelectionList/Search/ReportListItem.tsx | 1 - src/components/SelectionList/Search/TransactionListItem.tsx | 1 - src/components/SelectionList/TableListItem.tsx | 1 - src/components/SelectionList/UserListItem.tsx | 1 - 6 files changed, 6 deletions(-) diff --git a/src/components/SelectionList/InviteMemberListItem.tsx b/src/components/SelectionList/InviteMemberListItem.tsx index 13b0014efb2d..e40b91844f60 100644 --- a/src/components/SelectionList/InviteMemberListItem.tsx +++ b/src/components/SelectionList/InviteMemberListItem.tsx @@ -56,7 +56,6 @@ function InviteMemberListItem({ canSelectMultiple={canSelectMultiple} onSelectRow={onSelectRow} onDismissError={onDismissError} - shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow} rightHandSideComponent={rightHandSideComponent} errors={item.errors} pendingAction={item.pendingAction} diff --git a/src/components/SelectionList/RadioListItem.tsx b/src/components/SelectionList/RadioListItem.tsx index c7884690c067..b14444789a1e 100644 --- a/src/components/SelectionList/RadioListItem.tsx +++ b/src/components/SelectionList/RadioListItem.tsx @@ -34,7 +34,6 @@ function RadioListItem({ showTooltip={showTooltip} onSelectRow={onSelectRow} onDismissError={onDismissError} - shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow} shouldPreventEnterKeySubmit={shouldPreventEnterKeySubmit} rightHandSideComponent={rightHandSideComponent} keyForList={item.keyForList} diff --git a/src/components/SelectionList/Search/ReportListItem.tsx b/src/components/SelectionList/Search/ReportListItem.tsx index bc5a84c33b90..d9ccc80dab6d 100644 --- a/src/components/SelectionList/Search/ReportListItem.tsx +++ b/src/components/SelectionList/Search/ReportListItem.tsx @@ -138,7 +138,6 @@ function ReportListItem({ canSelectMultiple={canSelectMultiple} onSelectRow={onSelectRow} onDismissError={onDismissError} - shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow} errors={item.errors} pendingAction={item.pendingAction} keyForList={item.keyForList} diff --git a/src/components/SelectionList/Search/TransactionListItem.tsx b/src/components/SelectionList/Search/TransactionListItem.tsx index b222631b7273..57650eda3049 100644 --- a/src/components/SelectionList/Search/TransactionListItem.tsx +++ b/src/components/SelectionList/Search/TransactionListItem.tsx @@ -42,7 +42,6 @@ function TransactionListItem({ canSelectMultiple={canSelectMultiple} onSelectRow={onSelectRow} onDismissError={onDismissError} - shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow} errors={item.errors} pendingAction={item.pendingAction} keyForList={item.keyForList} diff --git a/src/components/SelectionList/TableListItem.tsx b/src/components/SelectionList/TableListItem.tsx index d07d658f6b12..7c91dbbf0feb 100644 --- a/src/components/SelectionList/TableListItem.tsx +++ b/src/components/SelectionList/TableListItem.tsx @@ -53,7 +53,6 @@ function TableListItem({ canSelectMultiple={canSelectMultiple} onSelectRow={onSelectRow} onDismissError={onDismissError} - shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow} rightHandSideComponent={rightHandSideComponent} errors={item.errors} pendingAction={item.pendingAction} diff --git a/src/components/SelectionList/UserListItem.tsx b/src/components/SelectionList/UserListItem.tsx index d07ac03c00f5..6b957935bc51 100644 --- a/src/components/SelectionList/UserListItem.tsx +++ b/src/components/SelectionList/UserListItem.tsx @@ -59,7 +59,6 @@ function UserListItem({ canSelectMultiple={canSelectMultiple} onSelectRow={onSelectRow} onDismissError={onDismissError} - shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow} shouldPreventEnterKeySubmit={shouldPreventEnterKeySubmit} rightHandSideComponent={rightHandSideComponent} errors={item.errors} From 80105f220301e615c89a91d87203a5ecb65b8474 Mon Sep 17 00:00:00 2001 From: tienifr Date: Fri, 7 Jun 2024 16:09:01 +0700 Subject: [PATCH 4/5] fix lint --- src/components/SelectionList/InviteMemberListItem.tsx | 1 - src/components/SelectionList/RadioListItem.tsx | 1 - src/components/SelectionList/Search/ReportListItem.tsx | 2 -- src/components/SelectionList/Search/TransactionListItem.tsx | 1 - src/components/SelectionList/TableListItem.tsx | 1 - src/components/SelectionList/UserListItem.tsx | 1 - src/pages/InviteReportParticipantsPage.tsx | 2 -- src/pages/NewChatPage.tsx | 2 -- src/pages/RoomInvitePage.tsx | 2 -- src/pages/RoomMembersPage.tsx | 2 -- src/pages/iou/request/MoneyRequestParticipantsSelector.tsx | 2 -- src/pages/workspace/WorkspaceInvitePage.tsx | 2 -- src/pages/workspace/WorkspaceMembersPage.tsx | 2 -- src/pages/workspace/categories/WorkspaceCategoriesPage.tsx | 2 -- src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx | 2 -- src/pages/workspace/tags/WorkspaceTagsPage.tsx | 2 -- src/pages/workspace/tags/WorkspaceViewTagsPage.tsx | 2 -- src/pages/workspace/taxes/WorkspaceTaxesPage.tsx | 2 -- 18 files changed, 31 deletions(-) diff --git a/src/components/SelectionList/InviteMemberListItem.tsx b/src/components/SelectionList/InviteMemberListItem.tsx index e40b91844f60..2b3c01c04a69 100644 --- a/src/components/SelectionList/InviteMemberListItem.tsx +++ b/src/components/SelectionList/InviteMemberListItem.tsx @@ -24,7 +24,6 @@ function InviteMemberListItem({ onSelectRow, onCheckboxPress, onDismissError, - shouldPreventDefaultFocusOnSelectRow, rightHandSideComponent, onFocus, shouldSyncFocus, diff --git a/src/components/SelectionList/RadioListItem.tsx b/src/components/SelectionList/RadioListItem.tsx index b14444789a1e..48ca474f6c60 100644 --- a/src/components/SelectionList/RadioListItem.tsx +++ b/src/components/SelectionList/RadioListItem.tsx @@ -13,7 +13,6 @@ function RadioListItem({ isDisabled, onSelectRow, onDismissError, - shouldPreventDefaultFocusOnSelectRow, shouldPreventEnterKeySubmit, rightHandSideComponent, isMultilineSupported = false, diff --git a/src/components/SelectionList/Search/ReportListItem.tsx b/src/components/SelectionList/Search/ReportListItem.tsx index d9ccc80dab6d..36d3d5fba5a3 100644 --- a/src/components/SelectionList/Search/ReportListItem.tsx +++ b/src/components/SelectionList/Search/ReportListItem.tsx @@ -68,7 +68,6 @@ function ReportListItem({ canSelectMultiple, onSelectRow, onDismissError, - shouldPreventDefaultFocusOnSelectRow, onFocus, shouldSyncFocus, }: ReportListItemProps) { @@ -119,7 +118,6 @@ function ReportListItem({ canSelectMultiple={canSelectMultiple} onSelectRow={() => openReportInRHP(transactionItem)} onDismissError={onDismissError} - shouldPreventDefaultFocusOnSelectRow={shouldPreventDefaultFocusOnSelectRow} onFocus={onFocus} shouldSyncFocus={shouldSyncFocus} /> diff --git a/src/components/SelectionList/Search/TransactionListItem.tsx b/src/components/SelectionList/Search/TransactionListItem.tsx index 57650eda3049..7dbddb0a810a 100644 --- a/src/components/SelectionList/Search/TransactionListItem.tsx +++ b/src/components/SelectionList/Search/TransactionListItem.tsx @@ -13,7 +13,6 @@ function TransactionListItem({ canSelectMultiple, onSelectRow, onDismissError, - shouldPreventDefaultFocusOnSelectRow, onFocus, shouldSyncFocus, }: TransactionListItemProps) { diff --git a/src/components/SelectionList/TableListItem.tsx b/src/components/SelectionList/TableListItem.tsx index 7c91dbbf0feb..9fc138254f8b 100644 --- a/src/components/SelectionList/TableListItem.tsx +++ b/src/components/SelectionList/TableListItem.tsx @@ -21,7 +21,6 @@ function TableListItem({ onSelectRow, onCheckboxPress, onDismissError, - shouldPreventDefaultFocusOnSelectRow, rightHandSideComponent, onFocus, shouldSyncFocus, diff --git a/src/components/SelectionList/UserListItem.tsx b/src/components/SelectionList/UserListItem.tsx index 6b957935bc51..104990cf479c 100644 --- a/src/components/SelectionList/UserListItem.tsx +++ b/src/components/SelectionList/UserListItem.tsx @@ -25,7 +25,6 @@ function UserListItem({ onSelectRow, onCheckboxPress, onDismissError, - shouldPreventDefaultFocusOnSelectRow, shouldPreventEnterKeySubmit, rightHandSideComponent, onFocus, diff --git a/src/pages/InviteReportParticipantsPage.tsx b/src/pages/InviteReportParticipantsPage.tsx index a8bbedc6d9e3..feffded16129 100644 --- a/src/pages/InviteReportParticipantsPage.tsx +++ b/src/pages/InviteReportParticipantsPage.tsx @@ -13,7 +13,6 @@ import withNavigationTransitionEnd from '@components/withNavigationTransitionEnd import type {WithNavigationTransitionEndProps} from '@components/withNavigationTransitionEnd'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import * as LoginUtils from '@libs/LoginUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; @@ -228,7 +227,6 @@ function InviteReportParticipantsPage({betas, personalDetails, report, didScreen onSelectRow={toggleOption} onConfirm={inviteUsers} showScrollIndicator - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} showLoadingPlaceholder={!didScreenTransitionEnd || !OptionsListUtils.isPersonalDetailsReady(personalDetails)} footerContent={footerContent} /> diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index 2910ccadd7ee..bdae5403fdae 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -21,7 +21,6 @@ import useScreenWrapperTranstionStatus from '@hooks/useScreenWrapperTransitionSt import useStyledSafeAreaInsets from '@hooks/useStyledSafeAreaInsets'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; @@ -318,7 +317,6 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { rightHandSideComponent={itemRightSideComponent} footerContent={footerContent} showLoadingPlaceholder={!areOptionsInitialized} - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} isLoadingNewOptions={!!isSearchingForReports} initiallyFocusedOptionKey={firstKeyForList} shouldTextInputInterceptSwipe diff --git a/src/pages/RoomInvitePage.tsx b/src/pages/RoomInvitePage.tsx index afa57755ad70..0ca04b252069 100644 --- a/src/pages/RoomInvitePage.tsx +++ b/src/pages/RoomInvitePage.tsx @@ -19,7 +19,6 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportActions from '@libs/actions/Report'; import {READ_COMMANDS} from '@libs/API/types'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import HttpUtils from '@libs/HttpUtils'; import * as LoginUtils from '@libs/LoginUtils'; import Navigation from '@libs/Navigation/Navigation'; @@ -255,7 +254,6 @@ function RoomInvitePage({ onSelectRow={toggleOption} onConfirm={inviteUsers} showScrollIndicator - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} showLoadingPlaceholder={!areOptionsInitialized} isLoadingNewOptions={!!isSearchingForReports} /> diff --git a/src/pages/RoomMembersPage.tsx b/src/pages/RoomMembersPage.tsx index e737f1b1f94e..1c3f2f64238c 100644 --- a/src/pages/RoomMembersPage.tsx +++ b/src/pages/RoomMembersPage.tsx @@ -18,7 +18,6 @@ import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentU import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; @@ -308,7 +307,6 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) { onSelectAll={() => toggleAllUsers(data)} showLoadingPlaceholder={!OptionsListUtils.isPersonalDetailsReady(personalDetails) || !didLoadRoomMembers} showScrollIndicator - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} ListItem={UserListItem} onDismissError={dismissError} /> diff --git a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx index f7507cc90c2d..3c2fcbc37cde 100644 --- a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx +++ b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx @@ -18,7 +18,6 @@ import useNetwork from '@hooks/useNetwork'; import usePermissions from '@hooks/usePermissions'; import useScreenWrapperTranstionStatus from '@hooks/useScreenWrapperTransitionStatus'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import type {MaybePhraseKey} from '@libs/Localize'; import type {Options} from '@libs/OptionsListUtils'; import * as OptionsListUtils from '@libs/OptionsListUtils'; @@ -355,7 +354,6 @@ function MoneyRequestParticipantsSelector({participants = [], onFinish, onPartic textInputLabel={translate('selectionList.nameEmailOrPhoneNumber')} textInputHint={offlineMessage} onChangeText={setSearchTerm} - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} onSelectRow={(item) => (isIOUSplit ? addParticipantToSelection(item) : addSingleParticipant(item))} shouldDebounceRowSelect footerContent={footerContent} diff --git a/src/pages/workspace/WorkspaceInvitePage.tsx b/src/pages/workspace/WorkspaceInvitePage.tsx index 5d8c079d2d9b..819fd5ad53c6 100644 --- a/src/pages/workspace/WorkspaceInvitePage.tsx +++ b/src/pages/workspace/WorkspaceInvitePage.tsx @@ -18,7 +18,6 @@ import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportActions from '@libs/actions/Report'; import {READ_COMMANDS} from '@libs/API/types'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import HttpUtils from '@libs/HttpUtils'; import * as LoginUtils from '@libs/LoginUtils'; import Navigation from '@libs/Navigation/Navigation'; @@ -329,7 +328,6 @@ function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, poli onConfirm={inviteUser} showScrollIndicator showLoadingPlaceholder={!areOptionsInitialized || !didScreenTransitionEnd} - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} footerContent={footerContent} isLoadingNewOptions={!!isSearchingForReports} /> diff --git a/src/pages/workspace/WorkspaceMembersPage.tsx b/src/pages/workspace/WorkspaceMembersPage.tsx index 96f5a9eb461f..a16b79ec28b5 100644 --- a/src/pages/workspace/WorkspaceMembersPage.tsx +++ b/src/pages/workspace/WorkspaceMembersPage.tsx @@ -29,7 +29,6 @@ import usePrevious from '@hooks/usePrevious'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; @@ -576,7 +575,6 @@ function WorkspaceMembersPage({personalDetails, invitedEmailsToAccountIDsDraft, onSelectAll={() => toggleAllUsers(data)} onDismissError={dismissError} showLoadingPlaceholder={isLoading} - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} textInputRef={textInputRef} customListHeader={getCustomListHeader()} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} diff --git a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx index 1239a9937fd3..3bacb7427a56 100644 --- a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx +++ b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx @@ -24,7 +24,6 @@ import useNetwork from '@hooks/useNetwork'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; @@ -330,7 +329,6 @@ function WorkspaceCategoriesPage({route}: WorkspaceCategoriesPageProps) { sections={[{data: categoryList, isDisabled: false}]} onCheckboxPress={toggleCategory} onSelectRow={navigateToCategorySettings} - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} onSelectAll={toggleAllCategories} ListItem={TableListItem} onDismissError={dismissError} diff --git a/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx b/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx index e659750754a1..dfd44e5226a5 100644 --- a/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx +++ b/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx @@ -22,7 +22,6 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as CurrencyUtils from '@libs/CurrencyUtils'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Navigation from '@libs/Navigation/Navigation'; import type {FullScreenNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -305,7 +304,6 @@ function PolicyDistanceRatesPage({policy, route}: PolicyDistanceRatesPageProps) onSelectAll={toggleAllRates} onDismissError={dismissError} ListItem={TableListItem} - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} customListHeader={getCustomListHeader()} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} listHeaderContent={isSmallScreenWidth ? getHeaderText() : null} diff --git a/src/pages/workspace/tags/WorkspaceTagsPage.tsx b/src/pages/workspace/tags/WorkspaceTagsPage.tsx index f7afacce93ad..8040908544d0 100644 --- a/src/pages/workspace/tags/WorkspaceTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceTagsPage.tsx @@ -23,7 +23,6 @@ import useNetwork from '@hooks/useNetwork'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; @@ -348,7 +347,6 @@ function WorkspaceTagsPage({route}: WorkspaceTagsPageProps) { onSelectAll={toggleAllTags} ListItem={TableListItem} customListHeader={getCustomListHeader()} - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} onDismissError={(item) => Tag.clearPolicyTagErrors(policyID, item.value)} listHeaderContent={isSmallScreenWidth ? getHeaderText() : null} diff --git a/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx b/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx index 1b91777a22ad..3e910ea8c4b8 100644 --- a/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx @@ -20,7 +20,6 @@ import useNetwork from '@hooks/useNetwork'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -262,7 +261,6 @@ function WorkspaceViewTagsPage({route}: WorkspaceViewTagsProps) { showScrollIndicator ListItem={TableListItem} customListHeader={getCustomListHeader()} - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} onDismissError={(item) => Tag.clearPolicyTagErrors(policyID, item.value)} /> diff --git a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx index af77a668264c..5d65dc50a890 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx @@ -23,7 +23,6 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import {clearTaxRateError, deletePolicyTaxes, setPolicyTaxesEnabled} from '@libs/actions/TaxRate'; -import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -300,7 +299,6 @@ function WorkspaceTaxesPage({ ListItem={TableListItem} customListHeader={getCustomListHeader()} listHeaderContent={isSmallScreenWidth ? getHeaderText() : null} - shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} onDismissError={(item) => (item.keyForList ? clearTaxRateError(policyID, item.keyForList, item.pendingAction) : undefined)} showScrollIndicator={false} From 0b253d0a49a8f0859a8c16ad616a7b70834f8219 Mon Sep 17 00:00:00 2001 From: tienifr Date: Wed, 12 Jun 2024 18:36:46 +0700 Subject: [PATCH 5/5] fix does not remove shouldPreventDefaultFocusOnSelectRow in SelectionList --- src/pages/InviteReportParticipantsPage.tsx | 2 ++ src/pages/NewChatPage.tsx | 2 ++ src/pages/RoomInvitePage.tsx | 2 ++ src/pages/RoomMembersPage.tsx | 2 ++ src/pages/iou/request/MoneyRequestParticipantsSelector.tsx | 2 ++ src/pages/workspace/WorkspaceInvitePage.tsx | 2 ++ src/pages/workspace/WorkspaceMembersPage.tsx | 2 ++ src/pages/workspace/categories/WorkspaceCategoriesPage.tsx | 2 ++ src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx | 2 ++ src/pages/workspace/tags/WorkspaceTagsPage.tsx | 2 ++ src/pages/workspace/tags/WorkspaceViewTagsPage.tsx | 2 ++ src/pages/workspace/taxes/WorkspaceTaxesPage.tsx | 2 ++ 12 files changed, 24 insertions(+) diff --git a/src/pages/InviteReportParticipantsPage.tsx b/src/pages/InviteReportParticipantsPage.tsx index feffded16129..a8bbedc6d9e3 100644 --- a/src/pages/InviteReportParticipantsPage.tsx +++ b/src/pages/InviteReportParticipantsPage.tsx @@ -13,6 +13,7 @@ import withNavigationTransitionEnd from '@components/withNavigationTransitionEnd import type {WithNavigationTransitionEndProps} from '@components/withNavigationTransitionEnd'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import * as LoginUtils from '@libs/LoginUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; @@ -227,6 +228,7 @@ function InviteReportParticipantsPage({betas, personalDetails, report, didScreen onSelectRow={toggleOption} onConfirm={inviteUsers} showScrollIndicator + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} showLoadingPlaceholder={!didScreenTransitionEnd || !OptionsListUtils.isPersonalDetailsReady(personalDetails)} footerContent={footerContent} /> diff --git a/src/pages/NewChatPage.tsx b/src/pages/NewChatPage.tsx index bdae5403fdae..2910ccadd7ee 100755 --- a/src/pages/NewChatPage.tsx +++ b/src/pages/NewChatPage.tsx @@ -21,6 +21,7 @@ import useScreenWrapperTranstionStatus from '@hooks/useScreenWrapperTransitionSt import useStyledSafeAreaInsets from '@hooks/useStyledSafeAreaInsets'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; import * as OptionsListUtils from '@libs/OptionsListUtils'; @@ -317,6 +318,7 @@ function NewChatPage({isGroupChat}: NewChatPageProps) { rightHandSideComponent={itemRightSideComponent} footerContent={footerContent} showLoadingPlaceholder={!areOptionsInitialized} + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} isLoadingNewOptions={!!isSearchingForReports} initiallyFocusedOptionKey={firstKeyForList} shouldTextInputInterceptSwipe diff --git a/src/pages/RoomInvitePage.tsx b/src/pages/RoomInvitePage.tsx index 0ca04b252069..afa57755ad70 100644 --- a/src/pages/RoomInvitePage.tsx +++ b/src/pages/RoomInvitePage.tsx @@ -19,6 +19,7 @@ import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportActions from '@libs/actions/Report'; import {READ_COMMANDS} from '@libs/API/types'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import HttpUtils from '@libs/HttpUtils'; import * as LoginUtils from '@libs/LoginUtils'; import Navigation from '@libs/Navigation/Navigation'; @@ -254,6 +255,7 @@ function RoomInvitePage({ onSelectRow={toggleOption} onConfirm={inviteUsers} showScrollIndicator + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} showLoadingPlaceholder={!areOptionsInitialized} isLoadingNewOptions={!!isSearchingForReports} /> diff --git a/src/pages/RoomMembersPage.tsx b/src/pages/RoomMembersPage.tsx index 63ba37fa256a..0e3c098b7907 100644 --- a/src/pages/RoomMembersPage.tsx +++ b/src/pages/RoomMembersPage.tsx @@ -18,6 +18,7 @@ import type {WithCurrentUserPersonalDetailsProps} from '@components/withCurrentU import withCurrentUserPersonalDetails from '@components/withCurrentUserPersonalDetails'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; @@ -288,6 +289,7 @@ function RoomMembersPage({report, session, policies}: RoomMembersPageProps) { onSelectAll={() => toggleAllUsers(data)} showLoadingPlaceholder={!OptionsListUtils.isPersonalDetailsReady(personalDetails) || !didLoadRoomMembers} showScrollIndicator + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} ListItem={UserListItem} onDismissError={dismissError} /> diff --git a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx index 040217b84f1a..a87cf933f677 100644 --- a/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx +++ b/src/pages/iou/request/MoneyRequestParticipantsSelector.tsx @@ -18,6 +18,7 @@ import useNetwork from '@hooks/useNetwork'; import usePermissions from '@hooks/usePermissions'; import useScreenWrapperTranstionStatus from '@hooks/useScreenWrapperTransitionStatus'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import type {MaybePhraseKey} from '@libs/Localize'; import type {Options} from '@libs/OptionsListUtils'; import * as OptionsListUtils from '@libs/OptionsListUtils'; @@ -355,6 +356,7 @@ function MoneyRequestParticipantsSelector({participants = [], onFinish, onPartic textInputLabel={translate('selectionList.nameEmailOrPhoneNumber')} textInputHint={offlineMessage} onChangeText={setSearchTerm} + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} onSelectRow={(item) => (isIOUSplit ? addParticipantToSelection(item) : addSingleParticipant(item))} shouldDebounceRowSelect footerContent={footerContent} diff --git a/src/pages/workspace/WorkspaceInvitePage.tsx b/src/pages/workspace/WorkspaceInvitePage.tsx index 819fd5ad53c6..5d8c079d2d9b 100644 --- a/src/pages/workspace/WorkspaceInvitePage.tsx +++ b/src/pages/workspace/WorkspaceInvitePage.tsx @@ -18,6 +18,7 @@ import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; import * as ReportActions from '@libs/actions/Report'; import {READ_COMMANDS} from '@libs/API/types'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import HttpUtils from '@libs/HttpUtils'; import * as LoginUtils from '@libs/LoginUtils'; import Navigation from '@libs/Navigation/Navigation'; @@ -328,6 +329,7 @@ function WorkspaceInvitePage({route, betas, invitedEmailsToAccountIDsDraft, poli onConfirm={inviteUser} showScrollIndicator showLoadingPlaceholder={!areOptionsInitialized || !didScreenTransitionEnd} + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} footerContent={footerContent} isLoadingNewOptions={!!isSearchingForReports} /> diff --git a/src/pages/workspace/WorkspaceMembersPage.tsx b/src/pages/workspace/WorkspaceMembersPage.tsx index a16b79ec28b5..96f5a9eb461f 100644 --- a/src/pages/workspace/WorkspaceMembersPage.tsx +++ b/src/pages/workspace/WorkspaceMembersPage.tsx @@ -29,6 +29,7 @@ import usePrevious from '@hooks/usePrevious'; import useStyleUtils from '@hooks/useStyleUtils'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Log from '@libs/Log'; import Navigation from '@libs/Navigation/Navigation'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; @@ -575,6 +576,7 @@ function WorkspaceMembersPage({personalDetails, invitedEmailsToAccountIDsDraft, onSelectAll={() => toggleAllUsers(data)} onDismissError={dismissError} showLoadingPlaceholder={isLoading} + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} textInputRef={textInputRef} customListHeader={getCustomListHeader()} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} diff --git a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx index 3bacb7427a56..1239a9937fd3 100644 --- a/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx +++ b/src/pages/workspace/categories/WorkspaceCategoriesPage.tsx @@ -24,6 +24,7 @@ import useNetwork from '@hooks/useNetwork'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; @@ -329,6 +330,7 @@ function WorkspaceCategoriesPage({route}: WorkspaceCategoriesPageProps) { sections={[{data: categoryList, isDisabled: false}]} onCheckboxPress={toggleCategory} onSelectRow={navigateToCategorySettings} + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} onSelectAll={toggleAllCategories} ListItem={TableListItem} onDismissError={dismissError} diff --git a/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx b/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx index dfd44e5226a5..e659750754a1 100644 --- a/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx +++ b/src/pages/workspace/distanceRates/PolicyDistanceRatesPage.tsx @@ -22,6 +22,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import * as CurrencyUtils from '@libs/CurrencyUtils'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import Navigation from '@libs/Navigation/Navigation'; import type {FullScreenNavigatorParamList} from '@navigation/types'; import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper'; @@ -304,6 +305,7 @@ function PolicyDistanceRatesPage({policy, route}: PolicyDistanceRatesPageProps) onSelectAll={toggleAllRates} onDismissError={dismissError} ListItem={TableListItem} + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} customListHeader={getCustomListHeader()} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} listHeaderContent={isSmallScreenWidth ? getHeaderText() : null} diff --git a/src/pages/workspace/tags/WorkspaceTagsPage.tsx b/src/pages/workspace/tags/WorkspaceTagsPage.tsx index 8040908544d0..f7afacce93ad 100644 --- a/src/pages/workspace/tags/WorkspaceTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceTagsPage.tsx @@ -23,6 +23,7 @@ import useNetwork from '@hooks/useNetwork'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; import type {FullScreenNavigatorParamList} from '@libs/Navigation/types'; @@ -347,6 +348,7 @@ function WorkspaceTagsPage({route}: WorkspaceTagsPageProps) { onSelectAll={toggleAllTags} ListItem={TableListItem} customListHeader={getCustomListHeader()} + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} onDismissError={(item) => Tag.clearPolicyTagErrors(policyID, item.value)} listHeaderContent={isSmallScreenWidth ? getHeaderText() : null} diff --git a/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx b/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx index 3e910ea8c4b8..1b91777a22ad 100644 --- a/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx +++ b/src/pages/workspace/tags/WorkspaceViewTagsPage.tsx @@ -20,6 +20,7 @@ import useNetwork from '@hooks/useNetwork'; import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import localeCompare from '@libs/LocaleCompare'; import Navigation from '@libs/Navigation/Navigation'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -261,6 +262,7 @@ function WorkspaceViewTagsPage({route}: WorkspaceViewTagsProps) { showScrollIndicator ListItem={TableListItem} customListHeader={getCustomListHeader()} + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} onDismissError={(item) => Tag.clearPolicyTagErrors(policyID, item.value)} /> diff --git a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx index 5d65dc50a890..af77a668264c 100644 --- a/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx +++ b/src/pages/workspace/taxes/WorkspaceTaxesPage.tsx @@ -23,6 +23,7 @@ import useTheme from '@hooks/useTheme'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import {clearTaxRateError, deletePolicyTaxes, setPolicyTaxesEnabled} from '@libs/actions/TaxRate'; +import * as DeviceCapabilities from '@libs/DeviceCapabilities'; import * as ErrorUtils from '@libs/ErrorUtils'; import Navigation from '@libs/Navigation/Navigation'; import * as PolicyUtils from '@libs/PolicyUtils'; @@ -299,6 +300,7 @@ function WorkspaceTaxesPage({ ListItem={TableListItem} customListHeader={getCustomListHeader()} listHeaderContent={isSmallScreenWidth ? getHeaderText() : null} + shouldPreventDefaultFocusOnSelectRow={!DeviceCapabilities.canUseTouchScreen()} listHeaderWrapperStyle={[styles.ph9, styles.pv3, styles.pb5]} onDismissError={(item) => (item.keyForList ? clearTaxRateError(policyID, item.keyForList, item.pendingAction) : undefined)} showScrollIndicator={false}