import React, { useEffect, useRef, useState } from 'react'; import { View, Text, Pressable, StyleSheet, SafeAreaView, Animated, Easing } from 'react-native'; export default function App() { const scale = useRef(new Animated.Value(0.55)).current; const [running, setRunning] = useState(true); const [phase, setPhase] = useState('Breathe in'); useEffect(() => { let mounted = true; const cycle = () => { if (!mounted) return; setPhase('Breathe in'); Animated.timing(scale, { toValue: 1, duration: 4000, easing: Easing.inOut(Easing.ease), useNativeDriver: false }).start(() => { if (!mounted) return; setPhase('Hold'); Animated.timing(scale, { toValue: 1, duration: 1500, easing: Easing.linear, useNativeDriver: false }).start(() => { if (!mounted) return; setPhase('Breathe out'); Animated.timing(scale, { toValue: 0.55, duration: 4000, easing: Easing.inOut(Easing.ease), useNativeDriver: false }).start(() => mounted && cycle()); }); }); }; if (running) cycle(); return () => { mounted = false; scale.stopAnimation(); }; }, [running]); return ( EVENING CALM 4-7-8 Breathing {phase} 3:00session 12day streak setRunning((r) => !r)} style={({ pressed }) => [s.btn, pressed && { opacity: 0.8 }]}> {running ? 'Pause' : 'Resume'} ); } const s = StyleSheet.create({ safe: { flex: 1, backgroundColor: '#05181C' }, header: { paddingTop: 64, paddingHorizontal: 26, alignItems: 'center' }, kicker: { color: '#3FB8AF', fontSize: 12, fontWeight: '700', letterSpacing: 2 }, h1: { color: '#EAFBF9', fontSize: 26, fontWeight: '800', marginTop: 6 }, center: { flex: 1, alignItems: 'center', justifyContent: 'center' }, glow: { width: 260, height: 260, borderRadius: 130, backgroundColor: 'rgba(63,184,175,0.08)', alignItems: 'center', justifyContent: 'center' }, orb: { width: 220, height: 220, borderRadius: 110, backgroundColor: 'rgba(63,184,175,0.18)', alignItems: 'center', justifyContent: 'center' }, orbInner: { width: 140, height: 140, borderRadius: 70, backgroundColor: 'rgba(63,184,175,0.42)' }, phase: { color: '#EAFBF9', fontSize: 22, fontWeight: '600', marginTop: 40, letterSpacing: 0.5 }, footer: { paddingHorizontal: 26, paddingBottom: 40 }, stats: { flexDirection: 'row', justifyContent: 'center', gap: 48, marginBottom: 22 }, stat: { alignItems: 'center' }, statN: { color: '#EAFBF9', fontSize: 20, fontWeight: '700' }, statL: { color: '#5E8A88', fontSize: 12, marginTop: 2 }, btn: { backgroundColor: '#3FB8AF', borderRadius: 30, paddingVertical: 17, alignItems: 'center' }, btnText: { color: '#04221F', fontSize: 17, fontWeight: '800' }, });