@tamagui/react-native-web-lite
Version:
React Native for Web
63 lines (62 loc) • 2.28 kB
JavaScript
import * as React from "react";
import { useMemo, useRef } from "react";
import { pick, useMergeRefs, usePressEvents } from "@tamagui/react-native-web-internals";
var forwardPropsList = {
accessibilityDisabled: !0,
accessibilityLabel: !0,
accessibilityLiveRegion: !0,
accessibilityRole: !0,
accessibilityState: !0,
accessibilityValue: !0,
children: !0,
disabled: !0,
focusable: !0,
nativeID: !0,
onBlur: !0,
onFocus: !0,
onLayout: !0,
testID: !0
},
pickProps = function (props) {
return pick(props, forwardPropsList);
};
function TouchableWithoutFeedback(props, forwardedRef) {
var {
delayPressIn,
delayPressOut,
delayLongPress,
disabled,
focusable,
onLongPress,
onPress,
onPressIn,
onPressOut,
rejectResponderTermination
} = props,
hostRef = useRef(null),
pressConfig = useMemo(function () {
return {
cancelable: !rejectResponderTermination,
disabled,
delayLongPress,
delayPressStart: delayPressIn,
delayPressEnd: delayPressOut,
onLongPress,
onPress,
onPressStart: onPressIn,
onPressEnd: onPressOut
};
}, [disabled, delayPressIn, delayPressOut, delayLongPress, onLongPress, onPress, onPressIn, onPressOut, rejectResponderTermination]),
pressEventHandlers = usePressEvents(hostRef, pressConfig),
element = React.Children.only(props.children),
children = [element.props.children],
supportedProps = pickProps(props);
supportedProps.accessibilityDisabled = disabled, supportedProps.focusable = !disabled && focusable !== !1, supportedProps.ref = useMergeRefs(forwardedRef, hostRef, element.ref);
var elementProps = Object.assign(supportedProps, pressEventHandlers);
return /* @__PURE__ */React.cloneElement(element, elementProps, ...children);
}
var MemoedTouchableWithoutFeedback = /* @__PURE__ */React.memo(/* @__PURE__ */React.forwardRef(TouchableWithoutFeedback));
MemoedTouchableWithoutFeedback.displayName = "TouchableWithoutFeedback";
var TouchableWithoutFeedback_default = MemoedTouchableWithoutFeedback;
export { TouchableWithoutFeedback_default as default };
//# sourceMappingURL=TouchableWithoutFeedback.native.js.map