diff --git a/config/eslint/eslint.seatbelt.tsv b/config/eslint/eslint.seatbelt.tsv index 1b4e69dc718d..7fe1d8e289ec 100644 --- a/config/eslint/eslint.seatbelt.tsv +++ b/config/eslint/eslint.seatbelt.tsv @@ -469,7 +469,6 @@ "../../src/pages/Search/SearchMoneyRequestReportPage.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1 "../../src/pages/Search/SearchPage.tsx" "react-hooks/set-state-in-effect" 1 "../../src/pages/Search/SearchTransactionsChangeReport.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1 -"../../src/pages/Share/ShareRootPage.tsx" "@typescript-eslint/no-deprecated/InteractionManager.runAfterInteractions" 1 "../../src/pages/TransactionDuplicate/Confirmation.tsx" "react-hooks/refs" 12 "../../src/pages/Travel/TravelUpgrade.tsx" "react-hooks/set-state-in-effect" 1 "../../src/pages/ValidateLoginPage/index.web.tsx" "react-hooks/set-state-in-effect" 1 diff --git a/src/components/Share/ShareTabParticipantsSelector.tsx b/src/components/Share/ShareTabParticipantsSelector.tsx index b4b0c25b30ef..bf556aa7591b 100644 --- a/src/components/Share/ShareTabParticipantsSelector.tsx +++ b/src/components/Share/ShareTabParticipantsSelector.tsx @@ -1,4 +1,3 @@ -import type {Ref} from 'react'; import React, {useState} from 'react'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useOnyx from '@hooks/useOnyx'; @@ -14,20 +13,14 @@ import {validTransactionDraftIDsSelector} from '@src/selectors/TransactionDraft' type ShareTabParticipantsSelectorProps = { detailsPageRouteObject: typeof ROUTES.SHARE_SUBMIT_DETAILS | typeof ROUTES.SHARE_DETAILS; - ref?: Ref; }; -type InputFocusRef = { - focus?: () => void; -}; - -function ShareTabParticipantsSelectorComponent({detailsPageRouteObject, ref}: ShareTabParticipantsSelectorProps) { +function ShareTabParticipantsSelectorComponent({detailsPageRouteObject}: ShareTabParticipantsSelectorProps) { const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails(); const [draftTransactionIDs] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_DRAFT, {selector: validTransactionDraftIDsSelector}); const [selectedReportID, setSelectedReportID] = useState(); return ( { diff --git a/src/pages/Share/ShareRootPage.tsx b/src/pages/Share/ShareRootPage.tsx index 530cf7e8fa18..d8a45f746d49 100644 --- a/src/pages/Share/ShareRootPage.tsx +++ b/src/pages/Share/ShareRootPage.tsx @@ -1,8 +1,6 @@ import React, {useCallback, useEffect, useMemo, useRef, useState} from 'react'; -// eslint-disable-next-line no-restricted-imports -import {Alert, AppState, InteractionManager, View} from 'react-native'; +import {Alert, AppState, View} from 'react-native'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; -import type {AnimatedTextInputRef} from '@components/RNTextInput'; import ScreenWrapper from '@components/ScreenWrapper'; import TabNavigatorSkeleton from '@components/Skeletons/TabNavigatorSkeleton'; import TabSelector from '@components/TabSelector/TabSelector'; @@ -169,24 +167,6 @@ function ShareRootPage() { [isFileReady], ); - const shareTabInputRef = useRef(null); - const submitTabInputRef = useRef(null); - - // We're focusing the input using internal onPageSelected to fix input focus inconsistencies on native. - // More info: https://github.com/Expensify/App/issues/59388 - const onTabSelectFocusHandler = ({index}: {index: number}) => { - // We runAfterInteractions since the function is called in the animate block on web-based - // implementation, this fixes an animation glitch and matches the native internal delay - InteractionManager.runAfterInteractions(() => { - // Chat tab (0) / Room tab (1) according to OnyxTabNavigator (see below) - if (index === 0) { - shareTabInputRef.current?.focus(); - } else if (index === 1) { - submitTabInputRef.current?.focus(); - } - }); - }; - return ( - {() => } - {isFileScannable && {() => }} + {() => } + {isFileScannable && {() => }} ) : ( diff --git a/src/pages/Share/ShareTab.tsx b/src/pages/Share/ShareTab.tsx index 3a17ea12eb5e..48618dc5dafb 100644 --- a/src/pages/Share/ShareTab.tsx +++ b/src/pages/Share/ShareTab.tsx @@ -1,10 +1,8 @@ -import type {Ref} from 'react'; -import React, {useEffect, useImperativeHandle, useRef, useState} from 'react'; +import React, {useEffect, useState} from 'react'; import {View} from 'react-native'; import {usePersonalDetails} from '@components/OnyxListItemProvider'; import SelectionList from '@components/SelectionList'; import InviteMemberListItem from '@components/SelectionList/ListItem/InviteMemberListItem'; -import type {ListItem, SelectionListHandle} from '@components/SelectionList/types'; import Text from '@components/Text'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useDebouncedState from '@hooks/useDebouncedState'; @@ -33,22 +31,12 @@ const defaultListOptions = { categoryOptions: [], }; -type ShareTabRef = { - focus?: () => void; -}; - -type ShareTabProps = { - /** Reference to the outer element */ - ref?: Ref; -}; - -function ShareTab({ref}: ShareTabProps) { +function ShareTab() { const styles = useThemeStyles(); const {translate} = useLocalize(); const {isOffline} = useNetwork(); const [textInputValue, debouncedTextInputValue, setTextInputValue] = useDebouncedState(''); const [betas] = useOnyx(ONYXKEYS.BETAS); - const selectionListRef = useRef | null>(null); const [selectedReportID, setSelectedReportID] = useState(); const [countryCode = CONST.DEFAULT_COUNTRY_CODE] = useOnyx(ONYXKEYS.COUNTRY_CODE); const [loginList] = useOnyx(ONYXKEYS.LOGIN_LIST); @@ -61,9 +49,6 @@ function ShareTab({ref}: ShareTabProps) { const currentUserAccountID = currentUserPersonalDetails.accountID; const currentUserEmail = currentUserPersonalDetails.email ?? ''; const personalDetails = usePersonalDetails(); - useImperativeHandle(ref, () => ({ - focus: selectionListRef.current?.focusTextInput, - })); const {didScreenTransitionEnd} = useScreenWrapperTransitionStatus(); const {options: listOptions, isLoading} = useFilteredOptions({ @@ -157,7 +142,6 @@ function ShareTab({ref}: ShareTabProps) { hint: offlineMessage, onChangeText: setTextInputValue, headerMessage: header, - disableAutoFocus: true, }; const customListHeader = @@ -178,7 +162,6 @@ function ShareTab({ref}: ShareTabProps) { shouldSingleExecuteRowSelect onSelectRow={onSelectRow} isLoadingNewOptions={!!isSearchingForReports} - ref={selectionListRef} /> ); } diff --git a/src/pages/Share/SubmitTab.tsx b/src/pages/Share/SubmitTab.tsx index 471e39d4b1c4..50154043fb10 100644 --- a/src/pages/Share/SubmitTab.tsx +++ b/src/pages/Share/SubmitTab.tsx @@ -1,24 +1,9 @@ import React from 'react'; -import type {Ref} from 'react'; import ShareTabParticipantsSelector from '@components/Share/ShareTabParticipantsSelector'; import ROUTES from '@src/ROUTES'; -type InputFocusRef = { - focus?: () => void; -}; - -type SubmitTabProps = { - /** Reference to the outer element */ - ref?: Ref; -}; - -function SubmitTabComponent({ref}: SubmitTabProps) { - return ( - - ); +function SubmitTabComponent() { + return ; } const SubmitTab = SubmitTabComponent;