-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7827 from parasharrajat/hapticfeedbacl
Enable haptic feedback on the NumberPad
- Loading branch information
Showing
7 changed files
with
56 additions
and
66 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
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
60 changes: 0 additions & 60 deletions
60
src/components/PressableWithSecondaryInteraction/index.android.js
This file was deleted.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import {Platform} from 'react-native'; | ||
import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; | ||
|
||
function trigger() { | ||
// The constant effectHeavyClick is added in API level 29. | ||
// Docs: https://developer.android.com/reference/android/os/VibrationEffect#EFFECT_HEAVY_CLICK | ||
// We use keyboardTap added in API level 8 as a fallback. | ||
// Docs: https://developer.android.com/reference/android/view/HapticFeedbackConstants#KEYBOARD_TAP | ||
if (Platform.Version >= 29) { | ||
ReactNativeHapticFeedback.trigger('effectHeavyClick'); | ||
return; | ||
} | ||
ReactNativeHapticFeedback.trigger('keyboardTap'); | ||
} | ||
|
||
export default { | ||
trigger, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
import ReactNativeHapticFeedback from 'react-native-haptic-feedback'; | ||
|
||
function trigger() { | ||
ReactNativeHapticFeedback.trigger('selection', { | ||
enableVibrateFallback: true, | ||
}); | ||
} | ||
|
||
export default { | ||
trigger, | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* Web does not support Haptic feedback | ||
*/ | ||
export default { | ||
trigger: () => {}, | ||
}; |