feat: 更新依赖项并优化组件结构

- 在 package.json 和 package-lock.json 中新增 @sentry/react-native、react-native-device-info 和 react-native-purchases 依赖
- 更新统计页面,替换 CircularRing 组件为 FitnessRingsCard,增强健身数据展示
- 在布局文件中引入 ToastProvider,优化用户通知体验
- 新增 SuccessToast 组件,提供全局成功提示功能
- 更新健康数据获取逻辑,支持健身圆环数据的提取
- 优化多个组件的样式和交互,提升用户体验
This commit is contained in:
richarjiang
2025-08-21 09:51:25 +08:00
parent 19b92547e1
commit 78620f18ee
21 changed files with 2494 additions and 108 deletions

58
utils/toast.utils.ts Normal file
View File

@@ -0,0 +1,58 @@
/**
* 全局Toast工具函数
*
* 使用方式:
* import { Toast } from '@/utils/toast.utils';
*
* Toast.success('操作成功!');
* Toast.error('操作失败!');
* Toast.warning('注意!');
*/
import { ToastContextType } from '@/contexts/ToastContext';
let toastRef: ToastContextType | null = null;
export const setToastRef = (ref: ToastContextType) => {
toastRef = ref;
};
export const Toast = {
success: (message: string, duration?: number) => {
if (toastRef) {
toastRef.showSuccess(message, duration);
} else {
console.warn('Toast not initialized. Please wrap your app with ToastProvider');
}
},
error: (message: string, duration?: number) => {
if (toastRef) {
toastRef.showError(message, duration);
} else {
console.warn('Toast not initialized. Please wrap your app with ToastProvider');
}
},
warning: (message: string, duration?: number) => {
if (toastRef) {
toastRef.showWarning(message, duration);
} else {
console.warn('Toast not initialized. Please wrap your app with ToastProvider');
}
},
show: (config: {
message: string;
duration?: number;
backgroundColor?: string;
textColor?: string;
icon?: string;
}) => {
if (toastRef) {
toastRef.showToast(config);
} else {
console.warn('Toast not initialized. Please wrap your app with ToastProvider');
}
},
};