Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Mobile-Expensify
4 changes: 2 additions & 2 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ android {
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
multiDexEnabled rootProject.ext.multiDexEnabled
versionCode 1009032807
versionName "9.3.28-7"
versionCode 1009032808
versionName "9.3.28-8"
// 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"
Expand Down
2 changes: 1 addition & 1 deletion ios/NewExpensify/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>9.3.28.7</string>
<string>9.3.28.8</string>
<key>FullStory</key>
<dict>
<key>OrgId</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/NotificationServiceExtension/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleShortVersionString</key>
<string>9.3.28</string>
<key>CFBundleVersion</key>
<string>9.3.28.7</string>
<string>9.3.28.8</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionPointIdentifier</key>
Expand Down
2 changes: 1 addition & 1 deletion ios/ShareViewController/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleShortVersionString</key>
<string>9.3.28</string>
<key>CFBundleVersion</key>
<string>9.3.28.7</string>
<string>9.3.28.8</string>
<key>NSExtension</key>
<dict>
<key>NSExtensionAttributes</key>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "new.expensify",
"version": "9.3.28-7",
"version": "9.3.28-8",
"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.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {useIsFocused} from '@react-navigation/native';
import {FlashList} from '@shopify/flash-list';
import type {FlashListRef, ListRenderItemInfo} from '@shopify/flash-list';
import React, {useCallback, useImperativeHandle, useRef} from 'react';
import React, {useImperativeHandle, useRef} from 'react';
import type {TextInputKeyPressEvent} from 'react-native';
import {View} from 'react-native';
import type {ValueOf} from 'type-fest';
Expand Down Expand Up @@ -97,26 +97,23 @@ function BaseSelectionListWithSections<TItem extends ListItem>({
hasKeyBeenPressed.current = true;
};

const scrollToIndex = useCallback(
(index: number) => {
if (index < 0 || index >= flattenedData.length || !listRef.current) {
return;
}
const item = flattenedData.at(index);
if (!item) {
return;
}
try {
listRef.current.scrollToIndex({index});
} catch (error) {
// FlashList may throw if layout for this index doesn't exist yet
// This can happen when data changes rapidly (e.g., during search filtering)
// The layout will be computed on next render, so we can safely ignore this
Log.warn('SelectionListWithSections: error scrolling to index', {error});
}
},
[flattenedData],
);
const scrollToIndex = (index: number) => {
if (index < 0 || index >= flattenedData.length || !listRef.current) {
return;
}
const item = flattenedData.at(index);
if (!item) {
return;
}
try {
listRef.current.scrollToIndex({index});
} catch (error) {
// FlashList may throw if layout for this index doesn't exist yet
// This can happen when data changes rapidly (e.g., during search filtering)
// The layout will be computed on next render, so we can safely ignore this
Log.warn('SelectionListWithSections: error scrolling to index', {error});
}
};

const debouncedScrollToIndex = useDebounce(scrollToIndex, CONST.TIMING.LIST_SCROLLING_DEBOUNCE_TIME, {leading: true, trailing: true});

Expand Down Expand Up @@ -182,10 +179,6 @@ function BaseSelectionListWithSections<TItem extends ListItem>({
innerTextInputRef.current?.focus();
};

const clearInputAfterSelect = () => {
textInputOptions?.onChangeText?.('');
};

const updateAndScrollToFocusedIndex = (index: number, shouldScroll = true) => {
setFocusedIndex(index);
if (shouldScroll) {
Expand All @@ -202,8 +195,6 @@ function BaseSelectionListWithSections<TItem extends ListItem>({

useImperativeHandle(ref, () => ({
focusTextInput,
scrollToIndex,
clearInputAfterSelect,
updateAndScrollToFocusedIndex,
updateExternalTextInputFocus,
getFocusedOption: getFocusedItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ type SelectionListWithSectionsProps<TItem extends ListItem> = BaseSelectionListP

type SelectionListWithSectionsHandle<TItem extends ListItem = ListItem> = {
focusTextInput: () => void;
scrollToIndex: (index: number) => void;
clearInputAfterSelect: () => void;
updateAndScrollToFocusedIndex: (index: number, shouldScroll?: boolean) => void;
updateExternalTextInputFocus: (isTextInputFocused: boolean) => void;
getFocusedOption: () => TItem | undefined;
Expand Down
19 changes: 2 additions & 17 deletions src/components/SelectionList/components/TextInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,7 @@ function TextInput({
}: TextInputProps) {
const styles = useThemeStyles();
const {translate} = useLocalize();
const {
label,
value,
onChangeText,
errorText,
headerMessage,
hint,
disableAutoFocus,
placeholder,
maxLength,
inputMode,
ref: optionsRef,
style,
disableAutoCorrect,
shouldInterceptSwipe,
} = options ?? {};
const {label, value, onChangeText, errorText, headerMessage, hint, disableAutoFocus, placeholder, maxLength, inputMode, ref: optionsRef, style, disableAutoCorrect} = options ?? {};
const resultsFound = headerMessage !== translate('common.noResultsFound');
const noData = dataLength === 0 && !showLoadingPlaceholder;
const shouldShowHeaderMessage = !!headerMessage && (!isLoadingNewOptions || resultsFound || noData);
Expand Down Expand Up @@ -149,8 +134,8 @@ function TextInput({
isLoading={isLoading}
testID="selection-list-text-input"
errorText={errorText}
shouldInterceptSwipe={false}
autoCorrect={!disableAutoCorrect}
shouldInterceptSwipe={shouldInterceptSwipe ?? false}
/>
</View>
{shouldShowHeaderMessage && (
Expand Down
3 changes: 0 additions & 3 deletions src/components/SelectionList/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,6 @@ type TextInputOptions = {
/** Whether the text input auto correct should be disabled */
disableAutoCorrect?: boolean;

/** Whether the text input should intercept swipes */
shouldInterceptSwipe?: boolean;

/** Styles for the text input */
style?: {
/** Styles for the text input container */
Expand Down
10 changes: 7 additions & 3 deletions src/hooks/useFilteredOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,15 @@ function useFilteredOptions(config: UseFilteredOptionsConfig = {}): UseFilteredO
if (!options || isLoadingMore) {
return;
}
setIsLoadingMore(true);
setReportsLimit((prev) => prev + batchSize);

const hasMoreToLoad = options.reports.length < totalReports;
if (hasMoreToLoad) {
setIsLoadingMore(true);
setReportsLimit((prev) => prev + batchSize);
}
};

const hasMore = options ? reportsLimit < totalReports : false;
const hasMore = options ? options.reports.length < totalReports : false;

return {
options,
Expand Down
14 changes: 14 additions & 0 deletions src/libs/OptionsListUtils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2969,6 +2969,19 @@ function formatSectionsFromSearchTerm(
};
}

/**
* Helper method to get the `keyForList` for the first option in the OptionsList
*/
function getFirstKeyForList(data?: Option[] | null) {
if (!data?.length) {
return '';
}

const firstNonEmptyDataObj = data.at(0);

return firstNonEmptyDataObj?.keyForList ? firstNonEmptyDataObj?.keyForList : '';
}

function getPersonalDetailSearchTerms(item: Partial<SearchOptionData>, currentUserAccountID: number) {
if (item.accountID === currentUserAccountID) {
return getCurrentUserSearchTerms(item);
Expand Down Expand Up @@ -3366,6 +3379,7 @@ export {
getFilteredRecentAttendees,
getCurrentUserSearchTerms,
getEmptyOptions,
getFirstKeyForList,
getHeaderMessage,
getHeaderMessageForNonUserList,
getIOUConfirmationOptionsFromPayeePersonalDetail,
Expand Down
Loading
Loading