Skip to content
This repository has been archived by the owner on May 10, 2023. It is now read-only.

Commit

Permalink
Add default options to haptic feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed Sep 26, 2021
1 parent 4a402b5 commit e9cab81
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions packages/bumbag-native-haptic/src/Haptic/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,20 @@ export type { HapticFeedbackTypes, HapticOptions };

/////////////////////////////////////////////////////////////////////////////////

export function trigger(type: HapticFeedbackTypes, options: HapticOptions) {
ReactNativeHapticFeedback.trigger(type, options);
export function trigger(type: HapticFeedbackTypes, options?: HapticOptions) {
const { enableVibrateFallback = false, ignoreAndroidSystemSettings = false } = options || {};
ReactNativeHapticFeedback.trigger(type, { enableVibrateFallback, ignoreAndroidSystemSettings });
}

export function triggerImpact(type: HapticImpactProps['type'], options: HapticOptions) {
export function triggerImpact(type: HapticImpactProps['type'], options?: HapticOptions) {
trigger(getImpactType(type), options);
}

export function triggerNotification(type: HapticNotificationProps['type'], options: HapticOptions) {
export function triggerNotification(type: HapticNotificationProps['type'], options?: HapticOptions) {
trigger(getNotificationType(type), options);
}

export function triggerSelection(options: HapticOptions) {
export function triggerSelection(options?: HapticOptions) {
trigger('selection', options);
}

Expand Down

0 comments on commit e9cab81

Please sign in to comment.