fitness goals

on home screen update fix
This commit is contained in:
echo 2026-03-12 17:06:10 +01:00
parent c3a41d2b32
commit aba9b1395b

View File

@ -44,7 +44,7 @@ export default function HomeScreen() {
const { colors, typography } = useTheme();
const { refetchStatistics, forceRefresh, statistics, loading } =
useStatistics();
const { goals } = useFitnessGoals();
const { goals, refetchGoals } = useFitnessGoals();
const [refreshing, setRefreshing] = useState(false);
const [trackMealModalVisible, setTrackMealModalVisible] = useState(false);
const [addWaterModalVisible, setAddWaterModalVisible] = useState(false);
@ -57,18 +57,19 @@ export default function HomeScreen() {
const caloriesBounce = useRef(new Animated.Value(1)).current;
const waterBounce = useRef(new Animated.Value(1)).current;
// Refetch statistics when screen comes into focus
// Refetch statistics and goals when screen comes into focus
useFocusEffect(
useCallback(() => {
refetchStatistics();
}, [refetchStatistics]),
refetchGoals();
}, [refetchStatistics, refetchGoals]),
);
const onRefresh = useCallback(async () => {
setRefreshing(true);
await forceRefresh();
await Promise.all([forceRefresh(), refetchGoals()]);
setRefreshing(false);
}, [forceRefresh]);
}, [forceRefresh, refetchGoals]);
const getGreeting = () => {
const hour = new Date().getHours();