- 将目标页面改为任务列表,支持任务的创建、完成和跳过功能 - 新增任务卡片和任务进度卡片组件,展示任务状态和进度 - 实现任务数据的获取和管理,集成Redux状态管理 - 更新API服务,支持任务相关的CRUD操作 - 编写任务管理功能实现文档,详细描述功能和组件架构
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { Ionicons } from '@expo/vector-icons';
|
|
import React, { useEffect, useState } from 'react';
|
|
import { StyleSheet } from 'react-native';
|
|
import HealthDataService from '../../services/healthData';
|
|
import HealthDataCard from './HealthDataCard';
|
|
|
|
interface OxygenSaturationCardProps {
|
|
resetToken: number;
|
|
style?: object;
|
|
}
|
|
|
|
const OxygenSaturationCard: React.FC<OxygenSaturationCardProps> = ({
|
|
resetToken,
|
|
style
|
|
}) => {
|
|
const [oxygenSaturation, setOxygenSaturation] = useState<number | null>(null);
|
|
|
|
useEffect(() => {
|
|
const fetchOxygenSaturation = async () => {
|
|
const data = await HealthDataService.getOxygenSaturation();
|
|
setOxygenSaturation(data);
|
|
};
|
|
|
|
fetchOxygenSaturation();
|
|
}, [resetToken]);
|
|
|
|
const oxygenIcon = (
|
|
<Ionicons name="water" size={24} color="#3B82F6" />
|
|
);
|
|
|
|
return (
|
|
<HealthDataCard
|
|
title="血氧饱和度"
|
|
value={oxygenSaturation !== null ? oxygenSaturation.toString() : '--'}
|
|
unit="%"
|
|
icon={oxygenIcon}
|
|
style={style}
|
|
/>
|
|
);
|
|
};
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
},
|
|
});
|
|
|
|
export default OxygenSaturationCard; |