UNPKG

9.5 kBTypeScriptView Raw
1import * as React from 'react';
2import { Animated, StyleProp, TextStyle, View, ViewStyle } from 'react-native';
3import type { IconSource } from './Icon';
4import Surface from './Surface';
5import type { EllipsizeProp } from '../types';
6declare type Props = React.ComponentProps<typeof Surface> & {
7 /**
8 * Mode of the chip.
9 * - `flat` - flat chip without outline.
10 * - `outlined` - chip with an outline.
11 */
12 mode?: 'flat' | 'outlined';
13 /**
14 * Text content of the `Chip`.
15 */
16 children: React.ReactNode;
17 /**
18 * Icon to display for the `Chip`. Both icon and avatar cannot be specified.
19 */
20 icon?: IconSource;
21 /**
22 * Avatar to display for the `Chip`. Both icon and avatar cannot be specified.
23 */
24 avatar?: React.ReactNode;
25 /**
26 * Icon to display as the close button for the `Chip`. The icon appears only when the onClose prop is specified.
27 */
28 closeIcon?: IconSource;
29 /**
30 * Whether chip is selected.
31 */
32 selected?: boolean;
33 /**
34 * Whether to style the chip color as selected.
35 */
36 selectedColor?: string;
37 /**
38 * Whether the chip is disabled. A disabled chip is greyed out and `onPress` is not called on touch.
39 */
40 disabled?: boolean;
41 /**
42 * Accessibility label for the chip. This is read by the screen reader when the user taps the chip.
43 */
44 accessibilityLabel?: string;
45 /**
46 * Accessibility label for the close icon. This is read by the screen reader when the user taps the close icon.
47 */
48 closeIconAccessibilityLabel?: string;
49 /**
50 * Function to execute on press.
51 */
52 onPress?: () => void;
53 /**
54 * Function to execute on long press.
55 */
56 onLongPress?: () => void;
57 /**
58 * Function to execute on close button press. The close button appears only when this prop is specified.
59 */
60 onClose?: () => void;
61 /**
62 * Style of chip's text
63 */
64 textStyle?: StyleProp<TextStyle>;
65 style?: StyleProp<ViewStyle>;
66 /**
67 * @optional
68 */
69 theme: ReactNativePaper.Theme;
70 /**
71 * Pass down testID from chip props to touchable for Detox tests.
72 */
73 testID?: string;
74 /**
75 * Ellipsize Mode for the children text
76 */
77 ellipsizeMode?: EllipsizeProp;
78};
79declare const _default: React.ComponentType<(Pick<Pick<import("react-native").ViewProps & React.RefAttributes<View> & {
80 children: React.ReactNode;
81 style?: false | import("react-native").RegisteredStyle<ViewStyle> | Animated.Value | Animated.AnimatedInterpolation | Animated.WithAnimatedObject<ViewStyle> | Animated.WithAnimatedArray<ViewStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<ViewStyle> | import("react-native").RecursiveArray<ViewStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<ViewStyle>> | readonly (ViewStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<ViewStyle>)[]> | null | undefined;
82 theme: ReactNativePaper.Theme;
83}, keyof import("react-native").ViewProps | keyof React.RefAttributes<View>> & {
84 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
85} & {
86 /**
87 * Mode of the chip.
88 * - `flat` - flat chip without outline.
89 * - `outlined` - chip with an outline.
90 */
91 mode?: "flat" | "outlined" | undefined;
92 /**
93 * Text content of the `Chip`.
94 */
95 children: React.ReactNode;
96 /**
97 * Icon to display for the `Chip`. Both icon and avatar cannot be specified.
98 */
99 icon?: IconSource | undefined;
100 /**
101 * Avatar to display for the `Chip`. Both icon and avatar cannot be specified.
102 */
103 avatar?: React.ReactNode;
104 /**
105 * Icon to display as the close button for the `Chip`. The icon appears only when the onClose prop is specified.
106 */
107 closeIcon?: IconSource | undefined;
108 /**
109 * Whether chip is selected.
110 */
111 selected?: boolean | undefined;
112 /**
113 * Whether to style the chip color as selected.
114 */
115 selectedColor?: string | undefined;
116 /**
117 * Whether the chip is disabled. A disabled chip is greyed out and `onPress` is not called on touch.
118 */
119 disabled?: boolean | undefined;
120 /**
121 * Accessibility label for the chip. This is read by the screen reader when the user taps the chip.
122 */
123 accessibilityLabel?: string | undefined;
124 /**
125 * Accessibility label for the close icon. This is read by the screen reader when the user taps the close icon.
126 */
127 closeIconAccessibilityLabel?: string | undefined;
128 /**
129 * Function to execute on press.
130 */
131 onPress?: (() => void) | undefined;
132 /**
133 * Function to execute on long press.
134 */
135 onLongPress?: (() => void) | undefined;
136 /**
137 * Function to execute on close button press. The close button appears only when this prop is specified.
138 */
139 onClose?: (() => void) | undefined;
140 /**
141 * Style of chip's text
142 */
143 textStyle?: StyleProp<TextStyle>;
144 style?: StyleProp<ViewStyle>;
145 /**
146 * @optional
147 */
148 theme: ReactNativePaper.Theme;
149 /**
150 * Pass down testID from chip props to touchable for Detox tests.
151 */
152 testID?: string | undefined;
153 /**
154 * Ellipsize Mode for the children text
155 */
156 ellipsizeMode?: EllipsizeProp | undefined;
157}, "ellipsizeMode" | "onPress" | "onLongPress" | "icon" | keyof import("react-native").ViewProps | keyof React.RefAttributes<View> | "mode" | "disabled" | "selected" | "avatar" | "closeIconAccessibilityLabel" | "onClose" | "closeIcon" | "textStyle" | "selectedColor"> | Pick<Pick<import("react-native").ViewProps & React.RefAttributes<View> & {
158 children: React.ReactNode;
159 style?: false | import("react-native").RegisteredStyle<ViewStyle> | Animated.Value | Animated.AnimatedInterpolation | Animated.WithAnimatedObject<ViewStyle> | Animated.WithAnimatedArray<ViewStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<ViewStyle> | import("react-native").RecursiveArray<ViewStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<ViewStyle>> | readonly (ViewStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<ViewStyle>)[]> | null | undefined;
160 theme: ReactNativePaper.Theme;
161}, keyof import("react-native").ViewProps | keyof React.RefAttributes<View>> & {
162 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
163} & {
164 children?: React.ReactNode;
165} & {
166 /**
167 * Mode of the chip.
168 * - `flat` - flat chip without outline.
169 * - `outlined` - chip with an outline.
170 */
171 mode?: "flat" | "outlined" | undefined;
172 /**
173 * Text content of the `Chip`.
174 */
175 children: React.ReactNode;
176 /**
177 * Icon to display for the `Chip`. Both icon and avatar cannot be specified.
178 */
179 icon?: IconSource | undefined;
180 /**
181 * Avatar to display for the `Chip`. Both icon and avatar cannot be specified.
182 */
183 avatar?: React.ReactNode;
184 /**
185 * Icon to display as the close button for the `Chip`. The icon appears only when the onClose prop is specified.
186 */
187 closeIcon?: IconSource | undefined;
188 /**
189 * Whether chip is selected.
190 */
191 selected?: boolean | undefined;
192 /**
193 * Whether to style the chip color as selected.
194 */
195 selectedColor?: string | undefined;
196 /**
197 * Whether the chip is disabled. A disabled chip is greyed out and `onPress` is not called on touch.
198 */
199 disabled?: boolean | undefined;
200 /**
201 * Accessibility label for the chip. This is read by the screen reader when the user taps the chip.
202 */
203 accessibilityLabel?: string | undefined;
204 /**
205 * Accessibility label for the close icon. This is read by the screen reader when the user taps the close icon.
206 */
207 closeIconAccessibilityLabel?: string | undefined;
208 /**
209 * Function to execute on press.
210 */
211 onPress?: (() => void) | undefined;
212 /**
213 * Function to execute on long press.
214 */
215 onLongPress?: (() => void) | undefined;
216 /**
217 * Function to execute on close button press. The close button appears only when this prop is specified.
218 */
219 onClose?: (() => void) | undefined;
220 /**
221 * Style of chip's text
222 */
223 textStyle?: StyleProp<TextStyle>;
224 style?: StyleProp<ViewStyle>;
225 /**
226 * @optional
227 */
228 theme: ReactNativePaper.Theme;
229 /**
230 * Pass down testID from chip props to touchable for Detox tests.
231 */
232 testID?: string | undefined;
233 /**
234 * Ellipsize Mode for the children text
235 */
236 ellipsizeMode?: EllipsizeProp | undefined;
237}, "ellipsizeMode" | "onPress" | "onLongPress" | "icon" | keyof import("react-native").ViewProps | keyof React.RefAttributes<View> | "mode" | "disabled" | "selected" | "avatar" | "closeIconAccessibilityLabel" | "onClose" | "closeIcon" | "textStyle" | "selectedColor">) & {
238 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
239}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<Props> & (({ mode, children, icon, avatar, selected, disabled, accessibilityLabel, closeIconAccessibilityLabel, onPress, onLongPress, onClose, closeIcon, textStyle, style, theme, testID, selectedColor, ellipsizeMode, ...rest }: Props) => JSX.Element), {}>;
240export default _default;
241
\No newline at end of file