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
This commit is contained in:
56
utils/haptics.ts
Normal file
56
utils/haptics.ts
Normal file
@@ -0,0 +1,56 @@
|
||||
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);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user