Import apps/android/src/ui/animated-ellipsis.tsx

This commit is contained in:
QQ 2026-11-14 14:20:15 +08:00
parent 6142deb3ca
commit b08a978701
1 changed files with 19 additions and 0 deletions

View File

@ -0,0 +1,19 @@
import { useEffect, useState } from 'react'
import { Text } from 'react-native'
/** Keep timer updates local to the suffix, rather than rerendering its screen. */
export function AnimatedEllipsis() {
const [visible, setVisible] = useState(1)
useEffect(() => {
const timer = setInterval(() => setVisible(count => count % 3 + 1), 400)
return () => clearInterval(timer)
}, [])
return (
<Text accessible={false} accessibilityElementsHidden importantForAccessibility="no-hide-descendants">
{/* Keep the same glyphs in every frame so centered labels never shift. */}
<Text>.</Text>
<Text style={visible < 2 ? { color: 'transparent' } : undefined}>.</Text>
<Text style={visible < 3 ? { color: 'transparent' } : undefined}>.</Text>
</Text>
)
}