UNPKG

4.53 kBTypeScriptView Raw
1import * as React from 'react';
2import { Animated, GestureResponderEvent, StyleProp, View, ViewStyle } from 'react-native';
3import CardActions from './CardActions';
4import CardContent from './CardContent';
5import CardCover from './CardCover';
6import CardTitle from './CardTitle';
7import type { $Omit, ThemeProp } from '../../types';
8import Surface from '../Surface';
9type OutlinedCardProps = {
10 mode: 'outlined';
11 elevation?: never;
12};
13type ElevatedCardProps = {
14 mode?: 'elevated';
15 elevation?: number;
16};
17type ContainedCardProps = {
18 mode?: 'contained';
19 elevation?: never;
20};
21type Mode = 'elevated' | 'outlined' | 'contained';
22export type Props = $Omit<React.ComponentProps<typeof Surface>, 'mode'> & {
23 /**
24 * Mode of the Card.
25 * - `elevated` - Card with elevation.
26 * - `contained` - Card without outline and elevation @supported Available in v5.x with theme version 3
27 * - `outlined` - Card with an outline.
28 */
29 mode?: Mode;
30 /**
31 * Content of the `Card`.
32 */
33 children: React.ReactNode;
34 /**
35 * Function to execute on long press.
36 */
37 onLongPress?: () => void;
38 /**
39 * Function to execute on press.
40 */
41 onPress?: (e: GestureResponderEvent) => void;
42 /**
43 * Function to execute as soon as the touchable element is pressed and invoked even before onPress.
44 */
45 onPressIn?: (e: GestureResponderEvent) => void;
46 /**
47 * Function to execute as soon as the touch is released even before onPress.
48 */
49 onPressOut?: (e: GestureResponderEvent) => void;
50 /**
51 * The number of milliseconds a user must touch the element before executing `onLongPress`.
52 */
53 delayLongPress?: number;
54 /**
55 * If true, disable all interactions for this component.
56 */
57 disabled?: boolean;
58 /**
59 * Changes Card shadow and background on iOS and Android.
60 */
61 elevation?: 0 | 1 | 2 | 3 | 4 | 5 | Animated.Value;
62 /**
63 * Style of card's inner content.
64 */
65 contentStyle?: StyleProp<ViewStyle>;
66 style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
67 /**
68 * @optional
69 */
70 theme?: ThemeProp;
71 /**
72 * Pass down testID from card props to touchable
73 */
74 testID?: string;
75 /**
76 * Pass down accessible from card props to touchable
77 */
78 accessible?: boolean;
79};
80declare const Card: import("../../utils/forwardRef").ForwardRefComponent<View, (OutlinedCardProps | ElevatedCardProps | ContainedCardProps) & $Omit<Omit<import("../Surface").Props, "ref"> & React.RefAttributes<View>, "mode"> & {
81 /**
82 * Mode of the Card.
83 * - `elevated` - Card with elevation.
84 * - `contained` - Card without outline and elevation @supported Available in v5.x with theme version 3
85 * - `outlined` - Card with an outline.
86 */
87 mode?: Mode | undefined;
88 /**
89 * Content of the `Card`.
90 */
91 children: React.ReactNode;
92 /**
93 * Function to execute on long press.
94 */
95 onLongPress?: (() => void) | undefined;
96 /**
97 * Function to execute on press.
98 */
99 onPress?: ((e: GestureResponderEvent) => void) | undefined;
100 /**
101 * Function to execute as soon as the touchable element is pressed and invoked even before onPress.
102 */
103 onPressIn?: ((e: GestureResponderEvent) => void) | undefined;
104 /**
105 * Function to execute as soon as the touch is released even before onPress.
106 */
107 onPressOut?: ((e: GestureResponderEvent) => void) | undefined;
108 /**
109 * The number of milliseconds a user must touch the element before executing `onLongPress`.
110 */
111 delayLongPress?: number | undefined;
112 /**
113 * If true, disable all interactions for this component.
114 */
115 disabled?: boolean | undefined;
116 /**
117 * Changes Card shadow and background on iOS and Android.
118 */
119 elevation?: 0 | 3 | 2 | 1 | 4 | 5 | Animated.Value | undefined;
120 /**
121 * Style of card's inner content.
122 */
123 contentStyle?: StyleProp<ViewStyle>;
124 style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
125 /**
126 * @optional
127 */
128 theme?: ThemeProp | undefined;
129 /**
130 * Pass down testID from card props to touchable
131 */
132 testID?: string | undefined;
133 /**
134 * Pass down accessible from card props to touchable
135 */
136 accessible?: boolean | undefined;
137}> & {
138 Content: typeof CardContent;
139 Actions: typeof CardActions;
140 Cover: typeof CardCover;
141 Title: typeof CardTitle;
142};
143export default Card;
144//# sourceMappingURL=Card.d.ts.map
\No newline at end of file