diff --git a/src/components/SelectionScreen.tsx b/src/components/SelectionScreen.tsx index 21416588f472..3315559894c4 100644 --- a/src/components/SelectionScreen.tsx +++ b/src/components/SelectionScreen.tsx @@ -102,14 +102,16 @@ type SelectionScreenProps = { /** Whether to show the text input */ shouldShowTextInput?: boolean; - /** Label for the text input */ - textInputLabel?: string; + textInputOptions?: { + /** Label for the text input */ + label?: string; - /** Value for the text input */ - textInputValue?: string; + /** Value for the text input */ + value?: string; - /** Callback to fire when the text input changes */ - onChangeText?: (text: string) => void; + /** Callback to fire when the text input changes */ + onChangeText?: (text: string) => void; + }; }; function SelectionScreen({ @@ -135,10 +137,8 @@ function SelectionScreen({ onClose, shouldSingleExecuteRowSelect, headerTitleAlreadyTranslated, - textInputLabel, - textInputValue, - onChangeText, shouldShowTextInput, + textInputOptions, shouldUpdateFocusedIndex = false, }: SelectionScreenProps) { const {translate} = useLocalize(); @@ -147,12 +147,6 @@ function SelectionScreen({ const [policy] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY}${policyID}`, {canBeMissing: false}); const isConnectionEmpty = isEmpty(policy?.connections?.[connectionName]); - const textInputOptions = { - onChangeText, - textInputLabel, - textInputValue, - }; - return ( [option.value]); }, [exportMenuItem?.data, searchText]); - const listEmptyContent = useMemo( - () => ( - - ), - [translate, currentConnectionName, styles, illustrations.Telescope], + const listEmptyContent = ( + ); - const updateExportAccount = useCallback( - ({value}: SelectorType) => { - if (!exportMenuItem?.exportType) { - return; - } - const isDefaultSelected = value === defaultCard || value === defaultVendor; - const exportValue = isDefaultSelected ? CONST.COMPANY_CARDS.DEFAULT_EXPORT_TYPE : value; - setCompanyCardExportAccount(policyID, domainOrWorkspaceAccountID, cardID, exportMenuItem.exportType, exportValue, getCompanyCardFeed(feed)); + const updateExportAccount = ({value}: SelectorType) => { + if (!exportMenuItem?.exportType) { + return; + } + const isDefaultSelected = value === defaultCard || value === defaultVendor; + const exportValue = isDefaultSelected ? CONST.COMPANY_CARDS.DEFAULT_EXPORT_TYPE : value; + setCompanyCardExportAccount(policyID, domainOrWorkspaceAccountID, cardID, exportMenuItem.exportType, exportValue, getCompanyCardFeed(feed)); - Navigation.goBack(ROUTES.WORKSPACE_COMPANY_CARD_DETAILS.getRoute(policyID, feed, cardID, backTo)); - }, - [exportMenuItem?.exportType, domainOrWorkspaceAccountID, cardID, policyID, feed, defaultCard, defaultVendor, backTo], - ); + Navigation.goBack(ROUTES.WORKSPACE_COMPANY_CARD_DETAILS.getRoute(policyID, feed, cardID, backTo)); + }; return ( mode.isSelected)?.keyForList} onBackButtonPress={() => Navigation.goBack(ROUTES.WORKSPACE_COMPANY_CARD_DETAILS.getRoute(policyID, feed, cardID, backTo))}