Files
orca/mobile/src/components/LoadingSpinner.tsx
T
Brennan Benson ee4fd06593 fix(mobile): the chat's Working line uses desktop's spinner (#30008)
* fix(mobile): the chat's Working line uses desktop's spinner (turning circle, hourglass under reduced motion)

* fix(mobile): keep working animations off interaction queue
2026-10-17 01:17:28 -07:00

27 lines
936 B
TypeScript

import { Animated } from 'react-native'
import { Hourglass, LoaderCircle } from 'lucide-react-native'
import { useReducedMotionEnabled } from '../platform/use-reduced-motion'
import { useWorkingRingRotation } from './use-working-ring-rotation'
/** Desktop's LoadingSpinner: the same turning circle, once per second.
* Why: a spinner frozen by reduced motion reads as stuck, so the still state is
* a different icon that says "working" without moving. */
export function LoadingSpinner({
size,
color
}: {
size: number
color: string
}): React.JSX.Element {
const reducedMotion = useReducedMotionEnabled()
const rotate = useWorkingRingRotation(reducedMotion === false)
if (reducedMotion) {
return <Hourglass size={size} color={color} strokeWidth={2} />
}
return (
<Animated.View style={{ transform: [{ rotate }] }}>
<LoaderCircle size={size} color={color} strokeWidth={2} />
</Animated.View>
)
}