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 2d3bd70
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 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';

Check failure on line 2 in src/components/Search/SearchPageHeader.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Imports "StyleProp" and "TextStyle" are only used as type

Check failure on line 2 in src/components/Search/SearchPageHeader.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'/home/runner/work/App/App/node_modules/react-native/index.js' imported multiple times
import {View} from 'react-native';

Check failure on line 3 in src/components/Search/SearchPageHeader.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'/home/runner/work/App/App/node_modules/react-native/index.js' imported multiple times
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

0 comments on commit 2d3bd70

Please sign in to comment.