diff --git a/Mobile-Expensify b/Mobile-Expensify index f1260bd7e7f2..76d2ae9113dc 160000 --- a/Mobile-Expensify +++ b/Mobile-Expensify @@ -1 +1 @@ -Subproject commit f1260bd7e7f206c31b66adb5ce68dbda5adee6ff +Subproject commit 76d2ae9113dc2b428c5565cb203198f765f7e3fe diff --git a/android/app/build.gradle b/android/app/build.gradle index 2e5e2a0d5b53..8b4e719121a0 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -114,8 +114,8 @@ android { minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion multiDexEnabled rootProject.ext.multiDexEnabled - versionCode 1009026504 - versionName "9.2.65-4" + versionCode 1009026505 + versionName "9.2.65-5" // Supported language variants must be declared here to avoid from being removed during the compilation. // This also helps us to not include unnecessary language variants in the APK. resConfigs "en", "es" diff --git a/ios/NewExpensify/Info.plist b/ios/NewExpensify/Info.plist index a087e283db1f..2738454ed4af 100644 --- a/ios/NewExpensify/Info.plist +++ b/ios/NewExpensify/Info.plist @@ -44,7 +44,7 @@ CFBundleVersion - 9.2.65.4 + 9.2.65.5 FullStory OrgId diff --git a/ios/NotificationServiceExtension/Info.plist b/ios/NotificationServiceExtension/Info.plist index be54aa261d4d..d3acb16fca05 100644 --- a/ios/NotificationServiceExtension/Info.plist +++ b/ios/NotificationServiceExtension/Info.plist @@ -13,7 +13,7 @@ CFBundleShortVersionString 9.2.65 CFBundleVersion - 9.2.65.4 + 9.2.65.5 NSExtension NSExtensionPointIdentifier diff --git a/ios/ShareViewController/Info.plist b/ios/ShareViewController/Info.plist index 27ab364e6975..a2dbde983eed 100644 --- a/ios/ShareViewController/Info.plist +++ b/ios/ShareViewController/Info.plist @@ -13,7 +13,7 @@ CFBundleShortVersionString 9.2.65 CFBundleVersion - 9.2.65.4 + 9.2.65.5 NSExtension NSExtensionAttributes diff --git a/package-lock.json b/package-lock.json index cca1c2760f89..73089afae0b1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "new.expensify", - "version": "9.2.65-4", + "version": "9.2.65-5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "new.expensify", - "version": "9.2.65-4", + "version": "9.2.65-5", "hasInstallScript": true, "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index ba7284b24aa9..84e4f6171525 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "new.expensify", - "version": "9.2.65-4", + "version": "9.2.65-5", "author": "Expensify, Inc.", "homepage": "https://new.expensify.com", "description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.", diff --git a/src/pages/AddUnreportedExpense.tsx b/src/pages/AddUnreportedExpense.tsx index 78ad0893ad97..f9c6fb0a917a 100644 --- a/src/pages/AddUnreportedExpense.tsx +++ b/src/pages/AddUnreportedExpense.tsx @@ -8,8 +8,8 @@ import HeaderWithBackButton from '@components/HeaderWithBackButton'; import LottieAnimations from '@components/LottieAnimations'; import {useSession} from '@components/OnyxListItemProvider'; import ScreenWrapper from '@components/ScreenWrapper'; -import SelectionList from '@components/SelectionList'; -import type {ListItem, SelectionListHandle} from '@components/SelectionList/types'; +import SelectionList from '@components/SelectionListWithSections'; +import type {ListItem, SectionListDataType, SelectionListHandle} from '@components/SelectionListWithSections/types'; import UnreportedExpensesSkeleton from '@components/Skeletons/UnreportedExpensesSkeleton'; import useDebouncedState from '@hooks/useDebouncedState'; import useLocalize from '@hooks/useLocalize'; @@ -153,14 +153,7 @@ function AddUnreportedExpense({route}: AddUnreportedExpensePageType) { }); }, [debouncedSearchValue, shouldShowTextInput, transactions]); - const unreportedExpenses = useMemo(() => { - return createUnreportedExpenseSections(filteredTransactions) - .flatMap((section) => section.data) - .map((item) => ({ - ...item, - isSelected: selectedIds.has(item.transactionID), - })); - }, [filteredTransactions, selectedIds]); + const sections: Array> = useMemo(() => createUnreportedExpenseSections(filteredTransactions), [filteredTransactions]); const handleConfirm = useCallback(() => { if (selectedIds.size === 0) { @@ -219,39 +212,11 @@ function AddUnreportedExpense({route}: AddUnreportedExpensePageType) { }, [errorMessage, styles, translate, handleConfirm]); const headerMessage = useMemo(() => { - if (debouncedSearchValue.trim() && unreportedExpenses?.length === 0) { + if (debouncedSearchValue.trim() && sections.at(0)?.data.length === 0) { return translate('common.noResultsFound'); } return ''; - }, [debouncedSearchValue, unreportedExpenses, translate]); - - const textInputOptions = useMemo( - () => ({ - value: searchValue, - label: shouldShowTextInput ? translate('iou.findExpense') : undefined, - onChangeText: setSearchValue, - headerMessage, - }), - [searchValue, shouldShowTextInput, translate, setSearchValue, headerMessage], - ); - - const onSelectRow = useCallback( - (item: {transactionID: string}) => { - setSelectedIds((prevIds) => { - const newIds = new Set(prevIds); - if (newIds.has(item.transactionID)) { - newIds.delete(item.transactionID); - } else { - newIds.add(item.transactionID); - if (errorMessage) { - setErrorMessage(''); - } - } - return newIds; - }); - }, - [errorMessage], - ); + }, [debouncedSearchValue, sections, translate]); const hasSearchTerm = debouncedSearchValue.trim().length > 0; const isShowingEmptyState = !hasSearchTerm && transactions.length === 0; @@ -333,12 +298,30 @@ function AddUnreportedExpense({route}: AddUnreportedExpensePageType) { onBackButtonPress={Navigation.goBack} /> - data={unreportedExpenses} ref={selectionListRef} - onSelectRow={onSelectRow} - textInputOptions={textInputOptions} + onSelectRow={(item) => { + setSelectedIds((prevIds) => { + const newIds = new Set(prevIds); + if (newIds.has(item.transactionID)) { + newIds.delete(item.transactionID); + } else { + newIds.add(item.transactionID); + if (errorMessage) { + setErrorMessage(''); + } + } + + return newIds; + }); + }} + isSelected={(item) => selectedIds.has(item.transactionID)} shouldShowTextInput={shouldShowTextInput} + textInputValue={searchValue} + textInputLabel={shouldShowTextInput ? translate('iou.findExpense') : undefined} + onChangeText={setSearchValue} + headerMessage={headerMessage} canSelectMultiple + sections={sections} ListItem={UnreportedExpenseListItem} onEndReached={fetchMoreUnreportedTransactions} onEndReachedThreshold={0.75}