新增手腕温度健康数据追踪,支持Apple Watch睡眠手腕温度数据展示和30天历史趋势分析 实现经期数据与HealthKit的完整双向同步,支持读取、写入和删除经期记录 优化经期预测算法,基于历史数据计算更准确的周期和排卵日预测 重构经期UI组件为模块化结构,提升代码可维护性 添加完整的中英文国际化支持,覆盖所有新增功能界面
102 lines
2.3 KiB
TypeScript
102 lines
2.3 KiB
TypeScript
import { Image } from 'expo-image';
|
|
import React from 'react';
|
|
import { Pressable, StyleSheet, Text, View } from 'react-native';
|
|
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
|
|
|
|
interface HealthDataCardProps {
|
|
title: string;
|
|
value: string;
|
|
unit: string;
|
|
style?: object;
|
|
onPress?: () => void;
|
|
}
|
|
|
|
const HealthDataCard: React.FC<HealthDataCardProps> = ({
|
|
title,
|
|
value,
|
|
unit,
|
|
style,
|
|
onPress
|
|
}) => {
|
|
const Container = onPress ? Pressable : View;
|
|
|
|
return (
|
|
<Animated.View entering={FadeIn.duration(300)} exiting={FadeOut.duration(300)} style={[styles.card, style]}>
|
|
<Container
|
|
style={styles.content}
|
|
onPress={onPress}
|
|
accessibilityRole={onPress ? 'button' : undefined}
|
|
accessibilityLabel={title}
|
|
accessibilityHint={onPress ? `${title} details` : undefined}
|
|
>
|
|
<View style={styles.headerRow}>
|
|
<Image source={require('@/assets/images/icons/icon-blood-oxygen.png')} style={styles.titleIcon} />
|
|
<Text style={styles.title}>{title}</Text>
|
|
</View>
|
|
<View style={styles.valueContainer}>
|
|
<Text style={styles.value}>{value}</Text>
|
|
<Text style={styles.unit}>{unit}</Text>
|
|
</View>
|
|
</Container>
|
|
</Animated.View>
|
|
);
|
|
};
|
|
|
|
const styles = StyleSheet.create({
|
|
card: {
|
|
shadowColor: '#000',
|
|
paddingHorizontal: 16,
|
|
shadowOffset: {
|
|
width: 0,
|
|
height: 2,
|
|
},
|
|
shadowOpacity: 0.1,
|
|
shadowRadius: 3.84,
|
|
elevation: 5,
|
|
marginVertical: 8,
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
},
|
|
content: {
|
|
flex: 1,
|
|
justifyContent: 'center',
|
|
},
|
|
headerRow: {
|
|
flexDirection: 'row',
|
|
alignItems: 'center',
|
|
marginBottom: 14,
|
|
},
|
|
titleIcon: {
|
|
width: 16,
|
|
height: 16,
|
|
marginRight: 6,
|
|
resizeMode: 'contain',
|
|
},
|
|
title: {
|
|
fontSize: 14,
|
|
color: '#192126',
|
|
fontWeight: '600',
|
|
fontFamily: 'AliBold',
|
|
},
|
|
valueContainer: {
|
|
flexDirection: 'row',
|
|
alignItems: 'flex-end',
|
|
},
|
|
value: {
|
|
fontSize: 16,
|
|
fontWeight: '600',
|
|
color: '#192126',
|
|
fontFamily: 'AliBold',
|
|
},
|
|
unit: {
|
|
fontSize: 12,
|
|
color: '#666',
|
|
marginLeft: 4,
|
|
marginBottom: 2,
|
|
fontWeight: '500',
|
|
fontFamily: 'AliRegular',
|
|
},
|
|
});
|
|
|
|
export default HealthDataCard;
|