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); } };