-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59a0f49
commit 4df3b60
Showing
3 changed files
with
38 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,27 @@ | ||
import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; | ||
import {HapticFeedbackError, HapticFeedbackLongPress, HapticFeedbackPress, HapticFeedbackSuccess} from './types'; | ||
import HapticFeedback from './types'; | ||
|
||
const press: HapticFeedbackPress = () => { | ||
ReactNativeHapticFeedback.trigger('impactLight', { | ||
enableVibrateFallback: true, | ||
}); | ||
const hapticFeedback: HapticFeedback = { | ||
press: () => { | ||
ReactNativeHapticFeedback.trigger('impactLight', { | ||
enableVibrateFallback: true, | ||
}); | ||
}, | ||
longPress: () => { | ||
ReactNativeHapticFeedback.trigger('impactHeavy', { | ||
enableVibrateFallback: true, | ||
}); | ||
}, | ||
success: () => { | ||
ReactNativeHapticFeedback.trigger('notificationSuccess', { | ||
enableVibrateFallback: true, | ||
}); | ||
}, | ||
error: () => { | ||
ReactNativeHapticFeedback.trigger('notificationError', { | ||
enableVibrateFallback: true, | ||
}); | ||
}, | ||
}; | ||
|
||
const longPress: HapticFeedbackLongPress = () => { | ||
ReactNativeHapticFeedback.trigger('impactHeavy', { | ||
enableVibrateFallback: true, | ||
}); | ||
}; | ||
|
||
const success: HapticFeedbackSuccess = () => { | ||
ReactNativeHapticFeedback.trigger('notificationSuccess', { | ||
enableVibrateFallback: true, | ||
}); | ||
}; | ||
|
||
const error: HapticFeedbackError = () => { | ||
ReactNativeHapticFeedback.trigger('notificationError', { | ||
enableVibrateFallback: true, | ||
}); | ||
}; | ||
|
||
export default { | ||
press, | ||
longPress, | ||
success, | ||
error, | ||
}; | ||
export default hapticFeedback; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import {HapticFeedbackError, HapticFeedbackLongPress, HapticFeedbackPress, HapticFeedbackSuccess} from './types'; | ||
import HapticFeedback from './types'; | ||
|
||
/** | ||
* Web does not support Haptic feedback | ||
*/ | ||
const press: HapticFeedbackPress = () => {}; | ||
const longPress: HapticFeedbackLongPress = () => {}; | ||
const success: HapticFeedbackSuccess = () => {}; | ||
const error: HapticFeedbackError = () => {}; | ||
const hapticFeedback: HapticFeedback = { | ||
press: () => {}, | ||
longPress: () => {}, | ||
success: () => {}, | ||
error: () => {}, | ||
}; | ||
|
||
export default {press, longPress, success, error}; | ||
export default hapticFeedback; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
type HapticFeedbackPress = () => void; | ||
type HapticFeedbackLongPress = () => void; | ||
type HapticFeedbackSuccess = () => void; | ||
type HapticFeedbackError = () => void; | ||
type HapticFeedback = { | ||
press: () => void; | ||
longPress: () => void; | ||
success: () => void; | ||
error: () => void; | ||
}; | ||
|
||
export type {HapticFeedbackPress, HapticFeedbackLongPress, HapticFeedbackSuccess, HapticFeedbackError}; | ||
export default HapticFeedback; |