1/** 2 * Copyright (c) Meta Platforms, Inc. and affiliates. 3 * 4 * This source code is licensed under the MIT license found in the 5 * LICENSE file in the root directory of this source tree. 6 * 7 * @format 8 */ 9 10import type * as React from 'react'; 11import {Constructor} from '../../../types/private/Utilities'; 12import {TimerMixin} from '../../../types/private/TimerMixin'; 13import {Insets} from '../../../types/public/Insets'; 14import {StyleProp} from '../../StyleSheet/StyleSheet'; 15import {ViewStyle} from '../../StyleSheet/StyleSheetTypes'; 16import { 17 GestureResponderEvent, 18 LayoutChangeEvent, 19 NativeSyntheticEvent, 20 TargetedEvent, 21} from '../../Types/CoreEventTypes'; 22import {AccessibilityProps} from '../View/ViewAccessibility'; 23import {TouchableMixin} from './Touchable'; 24 25export interface TouchableWithoutFeedbackPropsIOS {} 26 27export interface TouchableWithoutFeedbackPropsAndroid { 28 /** 29 * If true, doesn't play a system sound on touch. 30 * 31 * @platform android 32 */ 33 touchSoundDisabled?: boolean | undefined; 34} 35 36/** 37 * @see https://reactnative.dev/docs/touchablewithoutfeedback#props 38 */ 39export interface TouchableWithoutFeedbackProps 40 extends TouchableWithoutFeedbackPropsIOS, 41 TouchableWithoutFeedbackPropsAndroid, 42 AccessibilityProps { 43 children?: React.ReactNode; 44 45 /** 46 * Delay in ms, from onPressIn, before onLongPress is called. 47 */ 48 delayLongPress?: number | undefined; 49 50 /** 51 * Delay in ms, from the start of the touch, before onPressIn is called. 52 */ 53 delayPressIn?: number | undefined; 54 55 /** 56 * Delay in ms, from the release of the touch, before onPressOut is called. 57 */ 58 delayPressOut?: number | undefined; 59 60 /** 61 * If true, disable all interactions for this component. 62 */ 63 disabled?: boolean | undefined; 64 65 /** 66 * This defines how far your touch can start away from the button. 67 * This is added to pressRetentionOffset when moving off of the button. 68 * NOTE The touch area never extends past the parent view bounds and 69 * the Z-index of sibling views always takes precedence if a touch hits 70 * two overlapping views. 71 */ 72 hitSlop?: Insets | undefined; 73 74 /** 75 * Used to reference react managed views from native code. 76 */ 77 id?: string | undefined; 78 79 /** 80 * When `accessible` is true (which is the default) this may be called when 81 * the OS-specific concept of "blur" occurs, meaning the element lost focus. 82 * Some platforms may not have the concept of blur. 83 */ 84 onBlur?: ((e: NativeSyntheticEvent<TargetedEvent>) => void) | undefined; 85 86 /** 87 * When `accessible` is true (which is the default) this may be called when 88 * the OS-specific concept of "focus" occurs. Some platforms may not have 89 * the concept of focus. 90 */ 91 onFocus?: ((e: NativeSyntheticEvent<TargetedEvent>) => void) | undefined; 92 93 /** 94 * Invoked on mount and layout changes with 95 * {nativeEvent: {layout: {x, y, width, height}}} 96 */ 97 onLayout?: ((event: LayoutChangeEvent) => void) | undefined; 98 99 onLongPress?: ((event: GestureResponderEvent) => void) | undefined; 100 101 /** 102 * Called when the touch is released, 103 * but not if cancelled (e.g. by a scroll that steals the responder lock). 104 */ 105 onPress?: ((event: GestureResponderEvent) => void) | undefined; 106 107 onPressIn?: ((event: GestureResponderEvent) => void) | undefined; 108 109 onPressOut?: ((event: GestureResponderEvent) => void) | undefined; 110 111 /** 112 * //FIXME: not in doc but available in examples 113 */ 114 style?: StyleProp<ViewStyle> | undefined; 115 116 /** 117 * When the scroll view is disabled, this defines how far your 118 * touch may move off of the button, before deactivating the button. 119 * Once deactivated, try moving it back and you'll see that the button 120 * is once again reactivated! Move it back and forth several times 121 * while the scroll view is disabled. Ensure you pass in a constant 122 * to reduce memory allocations. 123 */ 124 pressRetentionOffset?: Insets | undefined; 125 126 /** 127 * Used to locate this view in end-to-end tests. 128 */ 129 testID?: string | undefined; 130} 131 132/** 133 * Do not use unless you have a very good reason. 134 * All the elements that respond to press should have a visual feedback when touched. 135 * This is one of the primary reason a "web" app doesn't feel "native". 136 * 137 * @see https://reactnative.dev/docs/touchablewithoutfeedback 138 */ 139declare class TouchableWithoutFeedbackComponent extends React.Component<TouchableWithoutFeedbackProps> {} 140declare const TouchableWithoutFeedbackBase: Constructor<TimerMixin> & 141 Constructor<TouchableMixin> & 142 typeof TouchableWithoutFeedbackComponent; 143export class TouchableWithoutFeedback extends TouchableWithoutFeedbackBase {} 144