Skip to content

Commit b1bfb73

Browse files
committed
Merge branch 'main' into @zfurtak/CustomCloseDateSelectionList
2 parents d8d30d9 + 5b134c4 commit b1bfb73

31 files changed

Lines changed: 230 additions & 136 deletions

Mobile-Expensify

android/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ android {
114114
minSdkVersion rootProject.ext.minSdkVersion
115115
targetSdkVersion rootProject.ext.targetSdkVersion
116116
multiDexEnabled rootProject.ext.multiDexEnabled
117-
versionCode 1009026500
118-
versionName "9.2.65-0"
117+
versionCode 1009026501
118+
versionName "9.2.65-1"
119119
// Supported language variants must be declared here to avoid from being removed during the compilation.
120120
// This also helps us to not include unnecessary language variants in the APK.
121121
resConfigs "en", "es"

ios/NewExpensify/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
</dict>
4545
</array>
4646
<key>CFBundleVersion</key>
47-
<string>9.2.65.0</string>
47+
<string>9.2.65.1</string>
4848
<key>FullStory</key>
4949
<dict>
5050
<key>OrgId</key>

ios/NotificationServiceExtension/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<key>CFBundleShortVersionString</key>
1414
<string>9.2.65</string>
1515
<key>CFBundleVersion</key>
16-
<string>9.2.65.0</string>
16+
<string>9.2.65.1</string>
1717
<key>NSExtension</key>
1818
<dict>
1919
<key>NSExtensionPointIdentifier</key>

ios/ShareViewController/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
<key>CFBundleShortVersionString</key>
1414
<string>9.2.65</string>
1515
<key>CFBundleVersion</key>
16-
<string>9.2.65.0</string>
16+
<string>9.2.65.1</string>
1717
<key>NSExtension</key>
1818
<dict>
1919
<key>NSExtensionAttributes</key>

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "new.expensify",
3-
"version": "9.2.65-0",
3+
"version": "9.2.65-1",
44
"author": "Expensify, Inc.",
55
"homepage": "https://new.expensify.com",
66
"description": "New Expensify is the next generation of Expensify: a reimagination of payments based atop a foundation of chat.",

src/ONYXKEYS.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,6 @@ const ONYXKEYS = {
132132
/** Whether the user is a member of a policy other than their personal */
133133
HAS_NON_PERSONAL_POLICY: 'hasNonPersonalPolicy',
134134

135-
/** Key under which selfDM id is stored. Returned by OpenApp */
136-
SELF_DM_REPORT_ID: 'selfDMReportID',
137-
138135
/** NVP keys */
139136

140137
/** This NVP contains list of at most 5 recent attendees */
@@ -1308,7 +1305,6 @@ type OnyxValuesMapping = {
13081305
[ONYXKEYS.NVP_LAST_DISTANCE_EXPENSE_TYPE]: DistanceExpenseType;
13091306
[ONYXKEYS.NVP_REPORT_LAYOUT_GROUP_BY]: string;
13101307
[ONYXKEYS.HAS_DENIED_CONTACT_IMPORT_PROMPT]: boolean | undefined;
1311-
[ONYXKEYS.SELF_DM_REPORT_ID]: string | undefined;
13121308
};
13131309

13141310
type OnyxDerivedValuesMapping = {

src/components/Search/SearchFiltersAmountBase.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ function SearchFiltersAmountBase({title, filterKey, testID}: {title: Translation
222222
role={CONST.ROLE.PRESENTATION}
223223
ref={inputCallbackRef}
224224
inputMode={CONST.INPUT_MODE.DECIMAL}
225+
shouldAllowNegative
225226
autoFocus
226227
uncontrolled
227228
/>

src/components/SelectionList/BaseSelectionList.tsx

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import useArrowKeyFocusManager from '@hooks/useArrowKeyFocusManager';
1212
import useDebounce from '@hooks/useDebounce';
1313
import useKeyboardShortcut from '@hooks/useKeyboardShortcut';
1414
import useKeyboardState from '@hooks/useKeyboardState';
15+
import usePrevious from '@hooks/usePrevious';
1516
import useSafeAreaPaddings from '@hooks/useSafeAreaPaddings';
1617
import useScrollEnabled from '@hooks/useScrollEnabled';
1718
import useSingleExecution from '@hooks/useSingleExecution';
@@ -288,7 +289,6 @@ function BaseSelectionList<TItem extends ListItem>({
288289
onFocusChange={(v: boolean) => (isTextInputFocusedRef.current = v)}
289290
showLoadingPlaceholder={showLoadingPlaceholder}
290291
isLoadingNewOptions={isLoadingNewOptions}
291-
setFocusedIndex={setFocusedIndex}
292292
/>
293293
);
294294
};
@@ -392,6 +392,56 @@ function BaseSelectionList<TItem extends ListItem>({
392392
[data.length, scrollToIndex, setFocusedIndex],
393393
);
394394

395+
const prevSearchValue = usePrevious(textInputOptions?.value);
396+
const prevSelectedOptionsLength = usePrevious(dataDetails.selectedOptions.length);
397+
const prevAllOptionsLength = usePrevious(data.length);
398+
399+
useEffect(() => {
400+
const currentSearchValue = textInputOptions?.value;
401+
const searchChanged = prevSearchValue !== currentSearchValue;
402+
const selectedOptionsChanged = dataDetails.selectedOptions.length !== prevSelectedOptionsLength;
403+
// Do not change focus if:
404+
// 1. Input value is the same or
405+
// 2. Data length is 0 or
406+
// 3. shouldUpdateFocusedIndex is true => other function handles the focus
407+
if ((!searchChanged && !selectedOptionsChanged) || data.length === 0 || shouldUpdateFocusedIndex) {
408+
return;
409+
}
410+
411+
const hasSearchBeenCleared = prevSearchValue && !currentSearchValue;
412+
if (hasSearchBeenCleared) {
413+
const foundSelectedItemIndex = data.findIndex(isItemSelected);
414+
415+
if (foundSelectedItemIndex !== -1 && !canSelectMultiple) {
416+
scrollToIndex(foundSelectedItemIndex);
417+
setFocusedIndex(foundSelectedItemIndex);
418+
return;
419+
}
420+
}
421+
422+
// Remove focus (set focused index to -1) if:
423+
// 1. If the search is idle or
424+
// 2. If the user is just toggling options without changing the list content
425+
// Otherwise (e.g. when filtering/typing), focus on the first item (0)
426+
const isSearchIdle = !prevSearchValue && !currentSearchValue;
427+
const newSelectedIndex = isSearchIdle || (selectedOptionsChanged && prevAllOptionsLength === data.length) ? -1 : 0;
428+
429+
scrollToIndex(newSelectedIndex);
430+
setFocusedIndex(newSelectedIndex);
431+
}, [
432+
canSelectMultiple,
433+
data,
434+
dataDetails.selectedOptions.length,
435+
isItemSelected,
436+
prevAllOptionsLength,
437+
prevSelectedOptionsLength,
438+
prevSearchValue,
439+
scrollToIndex,
440+
setFocusedIndex,
441+
shouldUpdateFocusedIndex,
442+
textInputOptions?.value,
443+
]);
444+
395445
useEffect(() => {
396446
if (!itemFocusTimeoutRef.current) {
397447
return;

0 commit comments

Comments
 (0)