mirror of
https://github.com/tooot-app/app
synced 2025-06-05 22:19:13 +02:00
Add haptics and analytics
This commit is contained in:
24
src/components/haptics.ts
Normal file
24
src/components/haptics.ts
Normal file
@ -0,0 +1,24 @@
|
||||
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
|
Reference in New Issue
Block a user