feat: 支持食物库接口
This commit is contained in:
@@ -13,15 +13,10 @@ import {
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
// 导入统一的食物类型定义
|
||||
import type { FoodItem } from '@/types/food';
|
||||
|
||||
// 食物数据类型定义
|
||||
export interface FoodItem {
|
||||
id: string;
|
||||
name: string;
|
||||
emoji: string;
|
||||
calories: number;
|
||||
unit: string; // 单位,如 "100克"
|
||||
}
|
||||
// 导入统一的食物类型定义
|
||||
|
||||
// 营养信息接口
|
||||
interface NutritionInfo {
|
||||
@@ -185,9 +180,8 @@ export function FoodDetailModal({
|
||||
{/* 食物信息 */}
|
||||
<View style={styles.foodHeader}>
|
||||
<View style={styles.foodInfo}>
|
||||
<Text style={styles.foodEmoji}>{food.emoji}</Text>
|
||||
<Text style={styles.foodEmoji}>{food.emoji || '🍽️'}</Text>
|
||||
<Text style={styles.foodName}>{food.name}</Text>
|
||||
<Ionicons name="chevron-forward" size={20} color="#999" />
|
||||
</View>
|
||||
<TouchableOpacity
|
||||
onPress={() => setIsFavorite(!isFavorite)}
|
||||
@@ -255,7 +249,7 @@ export function FoodDetailModal({
|
||||
|
||||
{/* 保存按钮 */}
|
||||
<TouchableOpacity style={styles.saveButton} onPress={handleSave}>
|
||||
<Text style={styles.saveButtonText}>保存</Text>
|
||||
<Text style={styles.saveButtonText}>添加</Text>
|
||||
</TouchableOpacity>
|
||||
</ScrollView>
|
||||
</View>
|
||||
|
||||
Reference in New Issue
Block a user