UNPKG

@tamagui/react-native-web-lite

Version:
59 lines (58 loc) 2.16 kB
import * as React from "react"; import { useMemo, useRef } from "react"; import { pick, useMergeRefs, usePressEvents } from "@tamagui/react-native-web-internals"; const 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 = props => pick(props, forwardPropsList); function TouchableWithoutFeedback(props, forwardedRef) { const { delayPressIn, delayPressOut, delayLongPress, disabled, focusable, onLongPress, onPress, onPressIn, onPressOut, rejectResponderTermination } = props, hostRef = useRef(null), pressConfig = useMemo(() => ({ 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); const elementProps = Object.assign(supportedProps, pressEventHandlers); return React.cloneElement(element, elementProps, ...children); } const MemoedTouchableWithoutFeedback = React.memo(React.forwardRef(TouchableWithoutFeedback)); MemoedTouchableWithoutFeedback.displayName = "TouchableWithoutFeedback"; var TouchableWithoutFeedback_default = MemoedTouchableWithoutFeedback; export { TouchableWithoutFeedback_default as default }; //# sourceMappingURL=TouchableWithoutFeedback.mjs.map