feat: 更新应用配置和引入新依赖
- 修改 app.json,禁用平板支持以优化用户体验 - 在 package.json 和 package-lock.json 中新增 react-native-toast-message 依赖,支持消息提示功能 - 在多个组件中集成 Toast 组件,提升用户交互反馈 - 更新训练计划相关逻辑,优化状态管理和数据处理 - 调整样式以适应新功能的展示和交互
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { useAuthGuard } from '@/hooks/useAuthGuard';
|
||||
import {
|
||||
BMI_CATEGORIES,
|
||||
canCalculateBMI,
|
||||
@@ -5,7 +6,6 @@ import {
|
||||
type BMIResult
|
||||
} from '@/utils/bmi';
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import { useRouter } from 'expo-router';
|
||||
import React, { useState } from 'react';
|
||||
import {
|
||||
Modal,
|
||||
@@ -16,6 +16,7 @@ import {
|
||||
TouchableOpacity,
|
||||
View,
|
||||
} from 'react-native';
|
||||
import Toast from 'react-native-toast-message';
|
||||
|
||||
interface BMICardProps {
|
||||
weight?: number;
|
||||
@@ -24,7 +25,7 @@ interface BMICardProps {
|
||||
}
|
||||
|
||||
export function BMICard({ weight, height, style }: BMICardProps) {
|
||||
const router = useRouter();
|
||||
const { pushIfAuthedElseLogin } = useAuthGuard();
|
||||
const [showInfoModal, setShowInfoModal] = useState(false);
|
||||
|
||||
const canCalculate = canCalculateBMI(weight, height);
|
||||
@@ -41,7 +42,11 @@ export function BMICard({ weight, height, style }: BMICardProps) {
|
||||
}
|
||||
|
||||
const handleGoToProfile = () => {
|
||||
router.push('/profile/edit');
|
||||
Toast.show({
|
||||
text1: '请先登录',
|
||||
type: 'info',
|
||||
});
|
||||
pushIfAuthedElseLogin('/profile/edit');
|
||||
};
|
||||
|
||||
const handleShowInfoModal = () => {
|
||||
@@ -436,4 +441,4 @@ const styles = StyleSheet.create({
|
||||
borderRadius: 12,
|
||||
lineHeight: 20,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user