Add some comments

This commit is contained in:
DS Boyce
2026-03-03 13:27:09 -08:00
parent 4818b7b7e7
commit 4d6f98ba87
+5
View File
@@ -199,6 +199,9 @@ export function Provider({children}: React.PropsWithChildren<unknown>) {
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<unknown>) {
await googleTranslate(text, targetLangCode, sourceLangCode)
}
}
// Translate after the next state change.
LayoutAnimation.configureNext(
LayoutAnimation.Presets.easeInEaseOut,
() => void translateAfterAnimation(),