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(),