UNPKG

2.04 kBTypeScriptView Raw
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 {ColorValue, StyleProp} from '../../StyleSheet/StyleSheet';
12import {ViewStyle} from '../../StyleSheet/StyleSheetTypes';
13import {View} from '../../Components/View/View';
14import {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback';
15
16/**
17 * @see https://reactnative.dev/docs/touchablehighlight#props
18 */
19export interface TouchableHighlightProps extends TouchableWithoutFeedbackProps {
20 /**
21 * Determines what the opacity of the wrapped view should be when touch is active.
22 */
23 activeOpacity?: number | undefined;
24
25 /**
26 *
27 * Called immediately after the underlay is hidden
28 */
29 onHideUnderlay?: (() => void) | undefined;
30
31 /**
32 * Called immediately after the underlay is shown
33 */
34 onShowUnderlay?: (() => void) | undefined;
35
36 /**
37 * @see https://reactnative.dev/docs/view#style
38 */
39 style?: StyleProp<ViewStyle> | undefined;
40
41 /**
42 * The color of the underlay that will show through when the touch is active.
43 */
44 underlayColor?: ColorValue | undefined;
45}
46
47/**
48 * A wrapper for making views respond properly to touches.
49 * On press down, the opacity of the wrapped view is decreased,
50 * which allows the underlay color to show through, darkening or tinting the view.
51 * The underlay comes from adding a view to the view hierarchy,
52 * which can sometimes cause unwanted visual artifacts if not used correctly,
53 * for example if the backgroundColor of the wrapped view isn't explicitly set to an opaque color.
54 *
55 * NOTE: TouchableHighlight supports only one child
56 * If you wish to have several child components, wrap them in a View.
57 *
58 * @see https://reactnative.dev/docs/touchablehighlight
59 */
60export const TouchableHighlight: React.ForwardRefExoticComponent<
61 React.PropsWithoutRef<TouchableHighlightProps> & React.RefAttributes<View>
62>;
63
\No newline at end of file