This commit is contained in:
Zhiyuan Zheng 2021-03-11 22:31:00 +01:00
parent 1b23e3f0f3
commit a366687ec6
No known key found for this signature in database
GPG Key ID: 078A93AB607D85E0
1 changed files with 5 additions and 3 deletions

View File

@ -5,7 +5,9 @@ const haptics = (
type: 'Success' | 'Warning' | 'Error' | 'Light' | 'Medium' | 'Heavy'
) => {
if (Platform.OS === 'android') {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle['Light']).catch(error => {})
if (type === 'Error') {
Haptics.impactAsync(Haptics.ImpactFeedbackStyle['Light']).catch(() => {})
}
return
}
@ -14,13 +16,13 @@ const haptics = (
case 'Warning':
case 'Error':
Haptics.notificationAsync(Haptics.NotificationFeedbackType[type]).catch(
error => {}
() => {}
)
break
case 'Light':
case 'Medium':
case 'Heavy':
Haptics.impactAsync(Haptics.ImpactFeedbackStyle[type]).catch(error => {})
Haptics.impactAsync(Haptics.ImpactFeedbackStyle[type]).catch(() => {})
}
}