From ef4afe4ac92f553992f104c8430d1825d97ea387 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Tue, 23 Dec 2025 11:29:18 -0500 Subject: [PATCH 1/5] use adminsToDisplay so the filter preserves the isSelected state --- src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx b/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx index dc65eccba610..d0de0d8da7ab 100644 --- a/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx +++ b/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx @@ -118,7 +118,7 @@ function ShareBankAccount({route}: ShareBankAccountProps) { // Apply search filter if there's a search term if (debouncedSearchTerm) { const searchValue = getSearchValueForPhoneOrEmail(debouncedSearchTerm, countryCode).toLowerCase(); - adminsToDisplay = tokenizedSearch(admins, searchValue, (option) => [option.text ?? '', option.alternateText ?? '']); + adminsToDisplay = tokenizedSearch(adminsToDisplay, searchValue, (option) => [option.text ?? '', option.alternateText ?? '']); } return adminsToDisplay; From 886a58e7f50785fc7076aa9126c68fb8f8d73230 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Tue, 23 Dec 2025 11:35:03 -0500 Subject: [PATCH 2/5] use ternary to ensure we don't show share button for personal accounts --- src/pages/settings/Wallet/WalletPage/index.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/pages/settings/Wallet/WalletPage/index.tsx b/src/pages/settings/Wallet/WalletPage/index.tsx index 2e40c154c2ad..690d8b861d8b 100644 --- a/src/pages/settings/Wallet/WalletPage/index.tsx +++ b/src/pages/settings/Wallet/WalletPage/index.tsx @@ -130,9 +130,7 @@ function WalletPage() { type: CONST.PAYMENT_METHODS.DEBIT_CARD, }; } - if (accountData?.type === CONST.BANK_ACCOUNT.TYPE.BUSINESS) { - setShouldShowShareButton(accountData?.state === CONST.BANK_ACCOUNT.STATE.OPEN); - } + setShouldShowShareButton(accountData?.type === CONST.BANK_ACCOUNT.TYPE.BUSINESS && accountData?.state === CONST.BANK_ACCOUNT.STATE.OPEN); setPaymentMethod({ isSelectedPaymentMethodDefault: !!isDefault, selectedPaymentMethod: accountData ?? {}, From 79e7555cbe67db6e0b441b106c2d22f7db183c55 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Tue, 23 Dec 2025 11:51:22 -0500 Subject: [PATCH 3/5] fix filtering for selecting all admins --- .../ShareBankAccount/ShareBankAccount.tsx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx b/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx index d0de0d8da7ab..19b0e328ec8a 100644 --- a/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx +++ b/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx @@ -127,17 +127,19 @@ function ShareBankAccount({route}: ShareBankAccountProps) { const adminsList = getAdminList(); const toggleSelectAll = () => { - const hasSelectedOptions = selectedOptions.length > 0; setIsAlertVisible(false); - if (hasSelectedOptions) { - setSelectedOptions([]); + const areAllFilteredOptionsSelected = adminsList.length > 0 && adminsList.every((admin) => selectedOptions.some((selected) => selected.login === admin.login)); + + if (areAllFilteredOptionsSelected) { + const filteredLogins = new Set(adminsList.map((admin) => admin.login)); + setSelectedOptions(selectedOptions.filter((option) => !filteredLogins.has(option.login))); } else { - const selectedAllOptions = adminsList?.map((member) => ({ - ...member, - isSelected: true, - })); - setSelectedOptions(selectedAllOptions); + const existingLogins = new Set(selectedOptions.map((option) => option.login)); + const newSelections = adminsList + .filter((admin) => !existingLogins.has(admin.login)) + .map((admin) => ({...admin, isSelected: true})); + setSelectedOptions([...selectedOptions, ...newSelections]); } }; From 641856e0368c1b61f44e240169d4eae125f7ce45 Mon Sep 17 00:00:00 2001 From: Nikki Wines Date: Tue, 23 Dec 2025 12:22:36 -0500 Subject: [PATCH 4/5] use selection list with sections --- .../ShareBankAccount/ShareBankAccount.tsx | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx b/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx index 19b0e328ec8a..9691a8ffd5fd 100644 --- a/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx +++ b/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx @@ -6,8 +6,8 @@ import FormAlertWithSubmitButton from '@components/FormAlertWithSubmitButton'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; -import SelectionList from '@components/SelectionList'; -import UserListItem from '@components/SelectionList/ListItem/UserListItem'; +import SelectionList from '@components/SelectionListWithSections'; +import UserListItem from '@components/SelectionListWithSections/UserListItem'; import Text from '@components/Text'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useDebouncedState from '@hooks/useDebouncedState'; @@ -180,13 +180,12 @@ function ShareBankAccount({route}: ShareBankAccountProps) { {translate('walletPage.shareBankAccountTitle')} Date: Tue, 23 Dec 2025 12:37:45 -0500 Subject: [PATCH 5/5] undo selectionListWithOptions and add shouldClearInputOnSelect to SelectionList --- .../SelectionList/BaseSelectionList.tsx | 4 +++- src/components/SelectionList/types.ts | 3 +++ .../ShareBankAccount/ShareBankAccount.tsx | 21 +++++++++---------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/src/components/SelectionList/BaseSelectionList.tsx b/src/components/SelectionList/BaseSelectionList.tsx index 4ce19880da8d..f6a40a6dc6cd 100644 --- a/src/components/SelectionList/BaseSelectionList.tsx +++ b/src/components/SelectionList/BaseSelectionList.tsx @@ -80,6 +80,7 @@ function BaseSelectionList({ shouldSingleExecuteRowSelect = false, shouldPreventDefaultFocusOnSelectRow = false, shouldShowTextInput = !!textInputOptions?.label, + shouldClearInputOnSelect = false, shouldHighlightSelectedItem = true, shouldUseDefaultRightHandSideCheckmark, shouldDisableHoverStyle = false, @@ -187,7 +188,7 @@ function BaseSelectionList({ return; } if (canSelectMultiple) { - if (shouldShowTextInput) { + if (shouldShowTextInput && shouldClearInputOnSelect) { textInputOptions?.onChangeText?.(''); } else if (isSmallScreenWidth) { if (!item.isDisabledCheckbox) { @@ -211,6 +212,7 @@ function BaseSelectionList({ shouldUpdateFocusedIndex, onSelectRow, shouldShowTextInput, + shouldClearInputOnSelect, shouldPreventDefaultFocusOnSelectRow, isSmallScreenWidth, textInputOptions, diff --git a/src/components/SelectionList/types.ts b/src/components/SelectionList/types.ts index 636333dc560a..89033aab8eb0 100644 --- a/src/components/SelectionList/types.ts +++ b/src/components/SelectionList/types.ts @@ -151,6 +151,9 @@ type SelectionListProps = Partial & { /** Whether to show the text input */ shouldShowTextInput?: boolean; + /** Whether to clear the text input when a row is selected */ + shouldClearInputOnSelect?: boolean; + /** Whether to highlight the selected item */ shouldHighlightSelectedItem?: boolean; diff --git a/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx b/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx index 9691a8ffd5fd..49adfe17716a 100644 --- a/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx +++ b/src/pages/settings/Wallet/ShareBankAccount/ShareBankAccount.tsx @@ -6,8 +6,8 @@ import FormAlertWithSubmitButton from '@components/FormAlertWithSubmitButton'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; -import SelectionList from '@components/SelectionListWithSections'; -import UserListItem from '@components/SelectionListWithSections/UserListItem'; +import SelectionList from '@components/SelectionList'; +import UserListItem from '@components/SelectionList/ListItem/UserListItem'; import Text from '@components/Text'; import useCurrentUserPersonalDetails from '@hooks/useCurrentUserPersonalDetails'; import useDebouncedState from '@hooks/useDebouncedState'; @@ -136,9 +136,7 @@ function ShareBankAccount({route}: ShareBankAccountProps) { setSelectedOptions(selectedOptions.filter((option) => !filteredLogins.has(option.login))); } else { const existingLogins = new Set(selectedOptions.map((option) => option.login)); - const newSelections = adminsList - .filter((admin) => !existingLogins.has(admin.login)) - .map((admin) => ({...admin, isSelected: true})); + const newSelections = adminsList.filter((admin) => !existingLogins.has(admin.login)).map((admin) => ({...admin, isSelected: true})); setSelectedOptions([...selectedOptions, ...newSelections]); } }; @@ -180,12 +178,13 @@ function ShareBankAccount({route}: ShareBankAccountProps) { {translate('walletPage.shareBankAccountTitle')}