- 在目标列表中添加左滑删除功能,用户可通过左滑手势显示删除按钮并确认删除目标 - 修改 GoalCard 组件,使用 Swipeable 组件包装卡片内容,支持删除操作 - 更新目标列表页面,集成删除目标的逻辑,确保与 Redux 状态管理一致 - 添加开发模式下的模拟数据,方便测试删除功能 - 更新相关文档,详细描述左滑删除功能的实现和使用方法
38 lines
842 B
TypeScript
38 lines
842 B
TypeScript
import { Ionicons } from '@expo/vector-icons';
|
|
import React from 'react';
|
|
import { StyleSheet } from 'react-native';
|
|
import HealthDataCard from './HealthDataCard';
|
|
|
|
interface OxygenSaturationCardProps {
|
|
resetToken: number;
|
|
style?: object;
|
|
oxygenSaturation?: number | null;
|
|
}
|
|
|
|
const OxygenSaturationCard: React.FC<OxygenSaturationCardProps> = ({
|
|
resetToken,
|
|
style,
|
|
oxygenSaturation
|
|
}) => {
|
|
const oxygenIcon = (
|
|
<Ionicons name="water" size={24} color="#3B82F6" />
|
|
);
|
|
|
|
return (
|
|
<HealthDataCard
|
|
title="血氧饱和度"
|
|
value={oxygenSaturation !== null && oxygenSaturation !== undefined ? oxygenSaturation.toFixed(1) : '--'}
|
|
unit="%"
|
|
icon={oxygenIcon}
|
|
style={style}
|
|
/>
|
|
);
|
|
};
|
|
|
|
const styles = StyleSheet.create({
|
|
container: {
|
|
flex: 1,
|
|
},
|
|
});
|
|
|
|
export default OxygenSaturationCard; |