Files
digital-pilates/utils/haptics.ts
richarjiang 83805a4b07 feat: Refactor MoodCalendarScreen to use dayjs for date handling and improve calendar data generation
feat: Update FitnessRingsCard to navigate to fitness rings detail page on press

feat: Modify NutritionRadarCard to enhance UI and add haptic feedback on actions

feat: Add FITNESS_RINGS_DETAIL route for navigation

fix: Adjust minimum fetch interval in BackgroundTaskManager for background tasks

feat: Implement haptic feedback utility functions for better user experience

feat: Extend health permissions to include Apple Exercise Time and Apple Stand Time

feat: Add functions to fetch hourly activity, exercise, and stand data for improved health tracking

feat: Enhance user preferences to manage fitness exercise minutes and active hours info dismissal
2025-09-05 15:32:34 +08:00

56 lines
1.3 KiB
TypeScript

import { Platform } from 'react-native';
import * as Haptics from 'expo-haptics';
/**
* 触发轻微震动反馈 (仅在 iOS 上生效)
*/
export const triggerLightHaptic = () => {
if (Platform.OS === 'ios') {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Light);
}
};
/**
* 触发中等震动反馈 (仅在 iOS 上生效)
*/
export const triggerMediumHaptic = () => {
if (Platform.OS === 'ios') {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Medium);
}
};
/**
* 触发强烈震动反馈 (仅在 iOS 上生效)
*/
export const triggerHeavyHaptic = () => {
if (Platform.OS === 'ios') {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle.Heavy);
}
};
/**
* 触发成功反馈震动 (仅在 iOS 上生效)
*/
export const triggerSuccessHaptic = () => {
if (Platform.OS === 'ios') {
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Success);
}
};
/**
* 触发警告反馈震动 (仅在 iOS 上生效)
*/
export const triggerWarningHaptic = () => {
if (Platform.OS === 'ios') {
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Warning);
}
};
/**
* 触发错误反馈震动 (仅在 iOS 上生效)
*/
export const triggerErrorHaptic = () => {
if (Platform.OS === 'ios') {
Haptics.notificationAsync(Haptics.NotificationFeedbackType.Error);
}
};