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.
This commit is contained in:
@@ -10,7 +10,7 @@ interface MoodCardProps {
|
||||
isLoading?: boolean;
|
||||
}
|
||||
|
||||
export function MoodCard({ moodCheckin, onPress, isLoading = false }: MoodCardProps) {
|
||||
export function MoodCard({ moodCheckin, onPress }: MoodCardProps) {
|
||||
const moodConfig = moodCheckin ? getMoodConfig(moodCheckin.moodType) : null;
|
||||
const animationRef = useRef<LottieView>(null);
|
||||
|
||||
@@ -21,7 +21,7 @@ export function MoodCard({ moodCheckin, onPress, isLoading = false }: MoodCardPr
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<TouchableOpacity onPress={onPress} style={styles.moodCardContent} disabled={isLoading}>
|
||||
<TouchableOpacity onPress={onPress} style={styles.moodCardContent} >
|
||||
<View style={styles.moodCardHeader}>
|
||||
<Text style={styles.cardTitle}>心情</Text>
|
||||
<LottieView
|
||||
@@ -32,11 +32,7 @@ export function MoodCard({ moodCheckin, onPress, isLoading = false }: MoodCardPr
|
||||
style={styles.lottieAnimation}
|
||||
/>
|
||||
</View>
|
||||
{isLoading ? (
|
||||
<View style={styles.moodPreview}>
|
||||
<Text style={styles.moodLoadingText}>加载中...</Text>
|
||||
</View>
|
||||
) : moodCheckin ? (
|
||||
{moodCheckin ? (
|
||||
<View style={styles.moodPreview}>
|
||||
<Text style={styles.moodPreviewText}>
|
||||
{moodConfig?.label || moodCheckin.moodType}
|
||||
@@ -69,8 +65,8 @@ const styles = StyleSheet.create({
|
||||
},
|
||||
|
||||
lottieAnimation: {
|
||||
width: 40,
|
||||
height: 40,
|
||||
width: 30,
|
||||
height: 30,
|
||||
},
|
||||
|
||||
moodPreview: {
|
||||
|
||||
Reference in New Issue
Block a user