We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a750b05 commit e211e8aCopy full SHA for e211e8a
1 file changed
app/modules/native-crypto/src/ReactNativeHapticsModule.ts
@@ -1,12 +1,24 @@
1
import { NativeModule, requireNativeModule } from 'expo';
2
+import { Platform, Vibration } from 'react-native';
3
4
declare class ReactNativeHapticsModule extends NativeModule {
5
triggerSlowRiseHaptic(): void;
6
triggerClickHaptic(): void;
7
cancelHaptic(): void;
8
}
9
-const module = requireNativeModule<ReactNativeHapticsModule>('LiftLogHaptics');
10
+const module =
11
+ Platform.OS === 'web'
12
+ ? {
13
+ triggerClickHaptic() {
14
+ try {
15
+ Vibration.vibrate(50);
16
+ } catch {}
17
+ },
18
+ triggerSlowRiseHaptic() {},
19
+ cancelHaptic() {},
20
+ }
21
+ : requireNativeModule<ReactNativeHapticsModule>('LiftLogHaptics');
22
23
export const triggerSlowRiseHaptic = () => {
24
module.triggerSlowRiseHaptic();
0 commit comments