- 在 package.json 和 package-lock.json 中新增 @sentry/react-native、react-native-device-info 和 react-native-purchases 依赖 - 更新统计页面,替换 CircularRing 组件为 FitnessRingsCard,增强健身数据展示 - 在布局文件中引入 ToastProvider,优化用户通知体验 - 新增 SuccessToast 组件,提供全局成功提示功能 - 更新健康数据获取逻辑,支持健身圆环数据的提取 - 优化多个组件的样式和交互,提升用户体验
24 lines
604 B
TypeScript
24 lines
604 B
TypeScript
import { Dimensions, StatusBar } from 'react-native';
|
|
import DeviceInfo from 'react-native-device-info';
|
|
|
|
export const getStatusBarHeight = () => {
|
|
return StatusBar.currentHeight;
|
|
};
|
|
|
|
export const getDeviceDimensions = () => {
|
|
const { width, height } = Dimensions.get('window');
|
|
|
|
// 检测是否为平板设备
|
|
const isTablet = DeviceInfo.isTablet();
|
|
|
|
// 对于平板设备,使用不同的基准尺寸
|
|
const baseWidth = isTablet ? 768 : 375; // iPad 通常使用 768pt 作为宽度基准
|
|
const ratio = width / baseWidth;
|
|
|
|
return {
|
|
width,
|
|
height,
|
|
ratio,
|
|
isTablet,
|
|
};
|
|
}; |