Files
digital-pilates/components/statistic/HealthDataCard.tsx
richarjiang 8b9689b269 Refactor components and enhance background task management
- Updated font sizes and weights in BasalMetabolismCard, MoodCard, HealthDataCard, and NutritionRadarCard for improved readability.
- Removed loading state from MoodCard to simplify the component.
- Adjusted styles in WeightHistoryCard for better layout and spacing.
- Integrated expo-background-fetch for improved background task handling.
- Updated Info.plist to include background fetch capability.
- Enhanced background task registration and execution logic in backgroundTaskManager.
- Added debug function to manually trigger background task execution for testing purposes.
2025-09-03 16:17:29 +08:00

77 lines
1.5 KiB
TypeScript

import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
interface HealthDataCardProps {
title: string;
value: string;
unit: string;
style?: object;
}
const HealthDataCard: React.FC<HealthDataCardProps> = ({
title,
value,
unit,
style
}) => {
return (
<Animated.View
entering={FadeIn.duration(300)}
exiting={FadeOut.duration(300)}
style={[styles.card, style]}
>
<View style={styles.content}>
<Text style={styles.title}>{title}</Text>
<View style={styles.valueContainer}>
<Text style={styles.value}>{value}</Text>
<Text style={styles.unit}>{unit}</Text>
</View>
</View>
</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',
},
title: {
fontSize: 14,
color: '#192126',
marginBottom: 14,
},
valueContainer: {
flexDirection: 'row',
alignItems: 'flex-end',
},
value: {
fontSize: 16,
fontWeight: '600',
color: '#192126',
},
unit: {
fontSize: 12,
color: '#666',
marginLeft: 4,
marginBottom: 2,
fontWeight: '500',
},
});
export default HealthDataCard;