Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/Expensify/App into feat/#Ex…
Browse files Browse the repository at this point in the history
…pensify#23230-highlight-linked-comment
  • Loading branch information
perunt committed Sep 23, 2023
2 parents a98f407 + 5aa7f6d commit 274df33
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 59 deletions.
39 changes: 27 additions & 12 deletions src/components/CategoryPicker/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,36 @@ function CategoryPicker({selectedCategory, policyCategories, policyRecentlyUsedC
];
}, [selectedCategory]);

const sections = useMemo(() => {
const {categoryOptions} = OptionsListUtils.getFilteredOptions(
{},
{},
[],
searchValue,
selectedOptions,
[],
false,
false,
true,
policyCategories,
policyRecentlyUsedCategories,
false,
);

return categoryOptions;
}, [policyCategories, policyRecentlyUsedCategories, searchValue, selectedOptions]);

const initialFocusedIndex = useMemo(() => {
if (isCategoriesCountBelowThreshold && selectedOptions.length > 0) {
return _.chain(policyCategories)
.values()
.findIndex((category) => category.name === selectedOptions[0].name, true)
.value();
}
let categoryInitialFocusedIndex = 0;

return 0;
}, [policyCategories, selectedOptions, isCategoriesCountBelowThreshold]);
if (!_.isEmpty(searchValue) || isCategoriesCountBelowThreshold) {
const index = _.findIndex(lodashGet(sections, '[0].data', []), (category) => category.searchText === iou.category);

const sections = useMemo(
() => OptionsListUtils.getFilteredOptions({}, {}, [], searchValue, selectedOptions, [], false, false, true, policyCategories, policyRecentlyUsedCategories, false).categoryOptions,
[policyCategories, policyRecentlyUsedCategories, searchValue, selectedOptions],
);
categoryInitialFocusedIndex = index === -1 ? 0 : index;
}

return categoryInitialFocusedIndex;
}, [iou.category, searchValue, isCategoriesCountBelowThreshold, sections]);

const headerMessage = OptionsListUtils.getHeaderMessage(lodashGet(sections, '[0].data.length', 0) > 0, false, searchValue);
const shouldShowTextInput = !isCategoriesCountBelowThreshold;
Expand Down
2 changes: 1 addition & 1 deletion src/components/HeaderPageLayout.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function HeaderPageLayout({backgroundColor, children, footer, headerContainerSty
titleColor={titleColor}
iconFill={iconFill}
/>
<View style={[styles.flex1, appBGColor, !isOffline ? safeAreaPaddingBottomStyle : {}]}>
<View style={[styles.flex1, appBGColor, !isOffline && !_.isNull(footer) ? safeAreaPaddingBottomStyle : {}]}>
{/** Safari on ios/mac has a bug where overscrolling the page scrollview shows green background color. This is a workaround to fix that. https://github.com/Expensify/App/issues/23422 */}
{Browser.isSafari() && (
<View style={styles.dualColorOverscrollSpacer}>
Expand Down
4 changes: 2 additions & 2 deletions src/components/OptionsSelector/BaseOptionsSelector.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,13 @@ class BaseOptionsSelector extends Component {
});
return;
}
const newFocusedIndex = this.props.selectedOptions.length;

const newFocusedIndex = this.props.selectedOptions.length;
// eslint-disable-next-line react/no-did-update-set-state
this.setState(
{
allOptions: newOptions,
focusedIndex: newFocusedIndex,
focusedIndex: _.isNumber(this.props.initialFocusedIndex) ? this.props.initialFocusedIndex : newFocusedIndex,
},
() => {
// If we just toggled an option on a multi-selection page or cleared the search input, scroll to top
Expand Down
3 changes: 1 addition & 2 deletions src/libs/migrateOnyx.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import _ from 'underscore';
import Log from './Log';
import AddEncryptedAuthToken from './migrations/AddEncryptedAuthToken';
import RenamePriorityModeKey from './migrations/RenamePriorityModeKey';
import RenameExpensifyNewsStatus from './migrations/RenameExpensifyNewsStatus';
import AddLastVisibleActionCreated from './migrations/AddLastVisibleActionCreated';
Expand All @@ -13,7 +12,7 @@ export default function () {

return new Promise((resolve) => {
// Add all migrations to an array so they are executed in order
const migrationPromises = [RenamePriorityModeKey, AddEncryptedAuthToken, RenameExpensifyNewsStatus, AddLastVisibleActionCreated, PersonalDetailsByAccountID, RenameReceiptFilename];
const migrationPromises = [RenamePriorityModeKey, RenameExpensifyNewsStatus, AddLastVisibleActionCreated, PersonalDetailsByAccountID, RenameReceiptFilename];

// Reduce all promises down to a single promise. All promises run in a linear fashion, waiting for the
// previous promise to finish before moving onto the next one.
Expand Down
42 changes: 0 additions & 42 deletions src/libs/migrations/AddEncryptedAuthToken.js

This file was deleted.

0 comments on commit 274df33

Please sign in to comment.