Something went wrong. Try again.
Your thinking partner.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950import { useEffect } from "react";import { StyleSheet, View } from "react-native";import Animated, { cancelAnimation, Easing, useAnimatedStyle, useReducedMotion, useSharedValue, withRepeat, withTiming,} from "react-native-reanimated";import { space } from "../../theme/tokens";import { Text } from "../ui/Text";import { Ring } from "../ui/Ring";
/** The send ring breathes gently while waiting for the agent's next response. */export function ThinkingIndicator() { const reducedMotion = useReducedMotion(); const breath = useSharedValue(0);
useEffect(() => { if (reducedMotion) return; breath.set(withRepeat(withTiming(1, { duration: 1600, easing: Easing.inOut(Easing.sin) }), -1, true)); return () => { cancelAnimation(breath); }; }, [breath, reducedMotion]);
const ringStyle = useAnimatedStyle(() => ({ opacity: 0.45 + breath.get() * 0.35, transform: [{ scale: 0.88 + breath.get() * 0.12 }], }));
return ( <View accessible accessibilityLabel="Thinking" accessibilityLiveRegion="polite" style={styles.row}> <View accessibilityElementsHidden importantForAccessibility="no-hide-descendants" style={styles.mark}> <Animated.View style={ringStyle}> <Ring size={22} /> </Animated.View> </View> <Text role="sub" ink={2} numberOfLines={1}>Thinking</Text> </View> );}
const styles = StyleSheet.create({ row: { minHeight: 30, flexDirection: "row", alignItems: "center", gap: 10, paddingHorizontal: space.gutter }, mark: { width: 22, height: 22, alignItems: "center", justifyContent: "center" },});