From 4d6f98ba8789d5171cef20409b64e697200b7f69 Mon Sep 17 00:00:00 2001 From: DS Boyce <260543580+ds-boyce@users.noreply.github.com> Date: Tue, 3 Mar 2026 13:27:09 -0800 Subject: [PATCH] Add some comments --- src/lib/translation/index.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/translation/index.tsx b/src/lib/translation/index.tsx index 88e46bee50..964c75db15 100644 --- a/src/lib/translation/index.tsx +++ b/src/lib/translation/index.tsx @@ -199,6 +199,9 @@ export function Provider({children}: React.PropsWithChildren) { await googleTranslate(text, targetLangCode, sourceLangCode) return } + + // Delay the translation until the animation completes for cases where the + // `attemptTranslation` call resolves very quickly. const translateAfterAnimation = async () => { try { const result = await attemptTranslation( @@ -240,6 +243,8 @@ export function Provider({children}: React.PropsWithChildren) { await googleTranslate(text, targetLangCode, sourceLangCode) } } + + // Translate after the next state change. LayoutAnimation.configureNext( LayoutAnimation.Presets.easeInEaseOut, () => void translateAfterAnimation(),