40 lines
1.3 KiB
React
40 lines
1.3 KiB
React
// Metro module 4168 (f4169).
|
|
import { useCallback } from "react";
|
|
import { Pressable } from "react-native";
|
|
import { HapticFeedbackTypes } from "./Module4162";
|
|
import Module4161 from "./Module4161";
|
|
export function TouchableHaptic(props) {
|
|
const { hapticType = HapticFeedbackTypes.impactMedium, hapticTrigger: _hapticTrigger, hapticOptions, onPressIn, onPress, onLongPress, ...props2 } = props;
|
|
const impactMedium = hapticType;
|
|
let hapticTrigger = props.hapticTrigger;
|
|
if (hapticTrigger === void 0) {
|
|
hapticTrigger = "onPressIn";
|
|
}
|
|
let c13874_1 = hapticTrigger;
|
|
const callback = useCallback(() => {
|
|
Module4161.trigger(impactMedium, hapticOptions);
|
|
}, [impactMedium, hapticOptions]);
|
|
return <Pressable onPressIn={useCallback((a0) => {
|
|
if (c13874_1 === "onPressIn") {
|
|
callback();
|
|
}
|
|
if (onPressIn != null) {
|
|
onPressIn(a0);
|
|
}
|
|
}, [hapticTrigger, callback, onPressIn])} onPress={useCallback((a0) => {
|
|
if (c13874_1 === "onPress") {
|
|
callback();
|
|
}
|
|
if (onPress != null) {
|
|
onPress(a0);
|
|
}
|
|
}, [hapticTrigger, callback, onPress])} onLongPress={useCallback((a0) => {
|
|
if (c13874_1 === "onLongPress") {
|
|
callback();
|
|
}
|
|
if (onLongPress != null) {
|
|
onLongPress(a0);
|
|
}
|
|
}, [hapticTrigger, callback, onLongPress])} {...props2} />;
|
|
}
|