Skip to content

Commit

Permalink
Fix translations flickering on Search delete modal
Browse files Browse the repository at this point in the history
  • Loading branch information
Kicu committed Oct 1, 2024
1 parent 76c5c81 commit 165e25e
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/components/Search/SearchPageHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {useMemo, useState} from 'react';
import type {StyleProp, TextStyle} from 'react-native';
import {InteractionManager, StyleProp, TextStyle} from 'react-native';
import {View} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import Button from '@components/Button';
Expand Down Expand Up @@ -150,9 +150,14 @@ function SearchPageHeader({queryJSON, hash}: SearchPageHeaderProps) {
return;
}

clearSelectedTransactions();
setIsDeleteExpensesConfirmModalVisible(false);
SearchActions.deleteMoneyRequestOnSearch(hash, selectedTransactionsKeys);

// Translations copy for delete modal depends on amount of selected items,
// We need to wait for modal to fully disappear before clearing them to avoid translation flicker between singular vs plural
InteractionManager.runAfterInteractions(() => {
clearSelectedTransactions();
});
};

const headerButtonsOptions = useMemo(() => {
Expand Down Expand Up @@ -359,6 +364,9 @@ function SearchPageHeader({queryJSON, hash}: SearchPageHeaderProps) {
</HeaderWrapper>
<ConfirmModal
isVisible={isDeleteExpensesConfirmModalVisible}
onModalHide={() => {
console.log('on hide', selectedTransactionsKeys);
}}
onConfirm={handleDeleteExpenses}
onCancel={() => {
setIsDeleteExpensesConfirmModalVisible(false);
Expand Down

0 comments on commit 165e25e

Please sign in to comment.