From 1ddbba212b269c330c5ff245024a04f0d8ef337d Mon Sep 17 00:00:00 2001 From: Mateusz Titz Date: Tue, 1 Oct 2024 14:56:29 +0200 Subject: [PATCH] Fix translations flickering on Search delete modal --- src/components/Search/SearchPageHeader.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/components/Search/SearchPageHeader.tsx b/src/components/Search/SearchPageHeader.tsx index 898de61aee64..130d27d4ba39 100644 --- a/src/components/Search/SearchPageHeader.tsx +++ b/src/components/Search/SearchPageHeader.tsx @@ -1,6 +1,6 @@ import React, {useMemo, useState} from 'react'; import type {StyleProp, TextStyle} from 'react-native'; -import {View} from 'react-native'; +import {InteractionManager, View} from 'react-native'; import {useOnyx} from 'react-native-onyx'; import Button from '@components/Button'; import ButtonWithDropdownMenu from '@components/ButtonWithDropdownMenu'; @@ -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(() => {