1
0
mirror of https://github.com/tooot-app/app synced 2025-06-05 22:19:13 +02:00
Files
tooot/src/components/haptics.ts
2020-12-30 14:33:33 +01:00

25 lines
620 B
TypeScript

import * as Haptics from 'expo-haptics'
import * as Sentry from 'sentry-expo'
const haptics = (
type: 'Success' | 'Warning' | 'Error' | 'Light' | 'Medium' | 'Heavy'
) => {
switch (type) {
case 'Success':
case 'Warning':
case 'Error':
Haptics.notificationAsync(Haptics.NotificationFeedbackType[type]).catch(
error => Sentry.Native.captureException(error)
)
break
case 'Light':
case 'Medium':
case 'Heavy':
Haptics.impactAsync(Haptics.ImpactFeedbackStyle[type]).catch(error =>
Sentry.Native.captureException(error)
)
}
}
export default haptics