- 实现拍照识别食物功能(集成大语言模型视觉能力) - 实现智能对话功能(集成大语言模型流式输出) - 实现食物记录和卡路里管理功能 - 实现体重记录和统计功能 - 实现健康数据管理页面 - 配置数据库表结构(用户、食物记录、体重记录) - 实现Express后端API路由 - 配置Tab导航和前端页面 - 采用健康运动配色方案
38 lines
839 B
TypeScript
38 lines
839 B
TypeScript
import React from 'react';
|
|
import { View, ViewProps, ViewStyle } from 'react-native';
|
|
import { useTheme } from '@/hooks/useTheme';
|
|
|
|
type BackgroundLevel = 'root' | 'default' | 'tertiary';
|
|
|
|
interface ThemedViewProps extends ViewProps {
|
|
level?: BackgroundLevel;
|
|
backgroundColor?: string;
|
|
}
|
|
|
|
const backgroundMap: Record<BackgroundLevel, string> = {
|
|
root: 'backgroundRoot',
|
|
default: 'backgroundDefault',
|
|
tertiary: 'backgroundTertiary',
|
|
};
|
|
|
|
export function ThemedView({
|
|
level = 'root',
|
|
backgroundColor,
|
|
style,
|
|
children,
|
|
...props
|
|
}: ThemedViewProps) {
|
|
const { theme } = useTheme();
|
|
const bgColor = backgroundColor ?? (theme as any)[backgroundMap[level]];
|
|
|
|
const viewStyle: ViewStyle = {
|
|
backgroundColor: bgColor,
|
|
};
|
|
|
|
return (
|
|
<View style={[viewStyle, style]} {...props}>
|
|
{children}
|
|
</View>
|
|
);
|
|
}
|