feat: 移除目标管理演示页面并优化相关组件
- 删除目标管理演示页面的代码,简化项目结构 - 更新底部导航,移除目标管理演示页面的路由 - 调整相关组件的样式和逻辑,确保界面一致性 - 优化颜色常量的使用,提升视觉效果
This commit is contained in:
@@ -1,29 +1,19 @@
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import React from 'react';
|
||||
import { StyleSheet } from 'react-native';
|
||||
import HealthDataService from '../../services/healthData';
|
||||
import HealthDataCard from './HealthDataCard';
|
||||
|
||||
interface HeartRateCardProps {
|
||||
resetToken: number;
|
||||
style?: object;
|
||||
heartRate?: number | null;
|
||||
}
|
||||
|
||||
const HeartRateCard: React.FC<HeartRateCardProps> = ({
|
||||
resetToken,
|
||||
style
|
||||
style,
|
||||
heartRate
|
||||
}) => {
|
||||
const [heartRate, setHeartRate] = useState<number | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const fetchHeartRate = async () => {
|
||||
const data = await HealthDataService.getHeartRate();
|
||||
setHeartRate(data);
|
||||
};
|
||||
|
||||
fetchHeartRate();
|
||||
}, [resetToken]);
|
||||
|
||||
const heartIcon = (
|
||||
<Ionicons name="heart" size={24} color="#EF4444" />
|
||||
);
|
||||
@@ -31,7 +21,7 @@ const HeartRateCard: React.FC<HeartRateCardProps> = ({
|
||||
return (
|
||||
<HealthDataCard
|
||||
title="心率"
|
||||
value={heartRate !== null ? heartRate.toString() : '--'}
|
||||
value={heartRate !== null && heartRate !== undefined ? Math.round(heartRate).toString() : '--'}
|
||||
unit="bpm"
|
||||
icon={heartIcon}
|
||||
style={style}
|
||||
|
||||
Reference in New Issue
Block a user