UNPKG

22.2 kBTypeScriptView Raw
1import * as React from 'react';
2import { Animated, StyleProp, ViewStyle, View } from 'react-native';
3import Button from './Button';
4import Surface from './Surface';
5export declare type SnackbarProps = React.ComponentProps<typeof Surface> & {
6 /**
7 * Whether the Snackbar is currently visible.
8 */
9 visible: boolean;
10 /**
11 * Label and press callback for the action button. It should contain the following properties:
12 * - `label` - Label of the action button
13 * - `onPress` - Callback that is called when action button is pressed.
14 */
15 action?: Omit<React.ComponentProps<typeof Button>, 'children'> & {
16 label: string;
17 };
18 /**
19 * The duration for which the Snackbar is shown.
20 */
21 duration?: number;
22 /**
23 * Callback called when Snackbar is dismissed. The `visible` prop needs to be updated when this is called.
24 */
25 onDismiss: () => void;
26 /**
27 * Text content of the Snackbar.
28 */
29 children: React.ReactNode;
30 /**
31 * Style for the wrapper of the snackbar
32 */
33 wrapperStyle?: StyleProp<ViewStyle>;
34 style?: StyleProp<ViewStyle>;
35 ref?: React.RefObject<View>;
36 /**
37 * @optional
38 */
39 theme: ReactNativePaper.Theme;
40};
41declare const _default: React.ComponentType<(Pick<Pick<import("react-native").ViewProps & React.RefAttributes<View> & {
42 children: React.ReactNode;
43 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;
44 theme: ReactNativePaper.Theme;
45}, keyof import("react-native").ViewProps | keyof React.RefAttributes<View>> & {
46 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
47} & {
48 /**
49 * Whether the Snackbar is currently visible.
50 */
51 visible: boolean;
52 /**
53 * Label and press callback for the action button. It should contain the following properties:
54 * - `label` - Label of the action button
55 * - `onPress` - Callback that is called when action button is pressed.
56 */
57 action?: (Omit<((Pick<Pick<import("react-native").ViewProps & React.RefAttributes<View> & {
58 children: React.ReactNode;
59 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;
60 theme: ReactNativePaper.Theme;
61 }, keyof import("react-native").ViewProps | keyof React.RefAttributes<View>> & {
62 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
63 } & {
64 mode?: "text" | "outlined" | "contained" | undefined;
65 dark?: boolean | undefined;
66 compact?: boolean | undefined;
67 color?: string | undefined;
68 loading?: boolean | undefined;
69 icon?: import("./Icon").IconSource | undefined;
70 disabled?: boolean | undefined;
71 children: React.ReactNode;
72 uppercase?: boolean | undefined;
73 accessibilityLabel?: string | undefined;
74 accessibilityHint?: string | undefined;
75 onPress?: (() => void) | undefined;
76 onLongPress?: (() => void) | undefined;
77 contentStyle?: StyleProp<ViewStyle>;
78 style?: StyleProp<ViewStyle>;
79 labelStyle?: StyleProp<import("react-native").TextStyle>;
80 theme: ReactNativePaper.Theme;
81 testID?: string | undefined;
82 }, "color" | "onPress" | "onLongPress" | "icon" | keyof import("react-native").ViewProps | "dark" | keyof React.RefAttributes<View> | "mode" | "uppercase" | "labelStyle" | "disabled" | "compact" | "loading" | "contentStyle"> | Pick<Pick<import("react-native").ViewProps & React.RefAttributes<View> & {
83 children: React.ReactNode;
84 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;
85 theme: ReactNativePaper.Theme;
86 }, keyof import("react-native").ViewProps | keyof React.RefAttributes<View>> & {
87 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
88 } & {
89 children?: React.ReactNode;
90 } & {
91 mode?: "text" | "outlined" | "contained" | undefined;
92 dark?: boolean | undefined;
93 compact?: boolean | undefined;
94 color?: string | undefined;
95 loading?: boolean | undefined;
96 icon?: import("./Icon").IconSource | undefined;
97 disabled?: boolean | undefined;
98 children: React.ReactNode;
99 uppercase?: boolean | undefined;
100 accessibilityLabel?: string | undefined;
101 accessibilityHint?: string | undefined;
102 onPress?: (() => void) | undefined;
103 onLongPress?: (() => void) | undefined;
104 contentStyle?: StyleProp<ViewStyle>;
105 style?: StyleProp<ViewStyle>;
106 labelStyle?: StyleProp<import("react-native").TextStyle>;
107 theme: ReactNativePaper.Theme;
108 testID?: string | undefined;
109 }, "color" | "onPress" | "onLongPress" | "icon" | keyof import("react-native").ViewProps | "dark" | keyof React.RefAttributes<View> | "mode" | "uppercase" | "labelStyle" | "disabled" | "compact" | "loading" | "contentStyle">) & {
110 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
111 }) | React.PropsWithChildren<(Pick<Pick<import("react-native").ViewProps & React.RefAttributes<View> & {
112 children: React.ReactNode;
113 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;
114 theme: ReactNativePaper.Theme;
115 }, keyof import("react-native").ViewProps | keyof React.RefAttributes<View>> & {
116 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
117 } & {
118 mode?: "text" | "outlined" | "contained" | undefined;
119 dark?: boolean | undefined;
120 compact?: boolean | undefined;
121 color?: string | undefined;
122 loading?: boolean | undefined;
123 icon?: import("./Icon").IconSource | undefined;
124 disabled?: boolean | undefined;
125 children: React.ReactNode;
126 uppercase?: boolean | undefined;
127 accessibilityLabel?: string | undefined;
128 accessibilityHint?: string | undefined;
129 onPress?: (() => void) | undefined;
130 onLongPress?: (() => void) | undefined;
131 contentStyle?: StyleProp<ViewStyle>;
132 style?: StyleProp<ViewStyle>;
133 labelStyle?: StyleProp<import("react-native").TextStyle>;
134 theme: ReactNativePaper.Theme;
135 testID?: string | undefined;
136 }, "color" | "onPress" | "onLongPress" | "icon" | keyof import("react-native").ViewProps | "dark" | keyof React.RefAttributes<View> | "mode" | "uppercase" | "labelStyle" | "disabled" | "compact" | "loading" | "contentStyle"> | Pick<Pick<import("react-native").ViewProps & React.RefAttributes<View> & {
137 children: React.ReactNode;
138 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;
139 theme: ReactNativePaper.Theme;
140 }, keyof import("react-native").ViewProps | keyof React.RefAttributes<View>> & {
141 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
142 } & {
143 children?: React.ReactNode;
144 } & {
145 mode?: "text" | "outlined" | "contained" | undefined;
146 dark?: boolean | undefined;
147 compact?: boolean | undefined;
148 color?: string | undefined;
149 loading?: boolean | undefined;
150 icon?: import("./Icon").IconSource | undefined;
151 disabled?: boolean | undefined;
152 children: React.ReactNode;
153 uppercase?: boolean | undefined;
154 accessibilityLabel?: string | undefined;
155 accessibilityHint?: string | undefined;
156 onPress?: (() => void) | undefined;
157 onLongPress?: (() => void) | undefined;
158 contentStyle?: StyleProp<ViewStyle>;
159 style?: StyleProp<ViewStyle>;
160 labelStyle?: StyleProp<import("react-native").TextStyle>;
161 theme: ReactNativePaper.Theme;
162 testID?: string | undefined;
163 }, "color" | "onPress" | "onLongPress" | "icon" | keyof import("react-native").ViewProps | "dark" | keyof React.RefAttributes<View> | "mode" | "uppercase" | "labelStyle" | "disabled" | "compact" | "loading" | "contentStyle">) & {
164 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
165 }>, "children"> & {
166 label: string;
167 }) | undefined;
168 /**
169 * The duration for which the Snackbar is shown.
170 */
171 duration?: number | undefined;
172 /**
173 * Callback called when Snackbar is dismissed. The `visible` prop needs to be updated when this is called.
174 */
175 onDismiss: () => void;
176 /**
177 * Text content of the Snackbar.
178 */
179 children: React.ReactNode;
180 /**
181 * Style for the wrapper of the snackbar
182 */
183 wrapperStyle?: StyleProp<ViewStyle>;
184 style?: StyleProp<ViewStyle>;
185 ref?: React.RefObject<View> | undefined;
186 /**
187 * @optional
188 */
189 theme: ReactNativePaper.Theme;
190}, "visible" | keyof import("react-native").ViewProps | keyof React.RefAttributes<View> | "onDismiss" | "action" | "duration" | "wrapperStyle"> | Pick<Pick<import("react-native").ViewProps & React.RefAttributes<View> & {
191 children: React.ReactNode;
192 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;
193 theme: ReactNativePaper.Theme;
194}, keyof import("react-native").ViewProps | keyof React.RefAttributes<View>> & {
195 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
196} & {
197 children?: React.ReactNode;
198} & {
199 /**
200 * Whether the Snackbar is currently visible.
201 */
202 visible: boolean;
203 /**
204 * Label and press callback for the action button. It should contain the following properties:
205 * - `label` - Label of the action button
206 * - `onPress` - Callback that is called when action button is pressed.
207 */
208 action?: (Omit<((Pick<Pick<import("react-native").ViewProps & React.RefAttributes<View> & {
209 children: React.ReactNode;
210 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;
211 theme: ReactNativePaper.Theme;
212 }, keyof import("react-native").ViewProps | keyof React.RefAttributes<View>> & {
213 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
214 } & {
215 mode?: "text" | "outlined" | "contained" | undefined;
216 dark?: boolean | undefined;
217 compact?: boolean | undefined;
218 color?: string | undefined;
219 loading?: boolean | undefined;
220 icon?: import("./Icon").IconSource | undefined;
221 disabled?: boolean | undefined;
222 children: React.ReactNode;
223 uppercase?: boolean | undefined;
224 accessibilityLabel?: string | undefined;
225 accessibilityHint?: string | undefined;
226 onPress?: (() => void) | undefined;
227 onLongPress?: (() => void) | undefined;
228 contentStyle?: StyleProp<ViewStyle>;
229 style?: StyleProp<ViewStyle>;
230 labelStyle?: StyleProp<import("react-native").TextStyle>;
231 theme: ReactNativePaper.Theme;
232 testID?: string | undefined;
233 }, "color" | "onPress" | "onLongPress" | "icon" | keyof import("react-native").ViewProps | "dark" | keyof React.RefAttributes<View> | "mode" | "uppercase" | "labelStyle" | "disabled" | "compact" | "loading" | "contentStyle"> | Pick<Pick<import("react-native").ViewProps & React.RefAttributes<View> & {
234 children: React.ReactNode;
235 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;
236 theme: ReactNativePaper.Theme;
237 }, keyof import("react-native").ViewProps | keyof React.RefAttributes<View>> & {
238 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
239 } & {
240 children?: React.ReactNode;
241 } & {
242 mode?: "text" | "outlined" | "contained" | undefined;
243 dark?: boolean | undefined;
244 compact?: boolean | undefined;
245 color?: string | undefined;
246 loading?: boolean | undefined;
247 icon?: import("./Icon").IconSource | undefined;
248 disabled?: boolean | undefined;
249 children: React.ReactNode;
250 uppercase?: boolean | undefined;
251 accessibilityLabel?: string | undefined;
252 accessibilityHint?: string | undefined;
253 onPress?: (() => void) | undefined;
254 onLongPress?: (() => void) | undefined;
255 contentStyle?: StyleProp<ViewStyle>;
256 style?: StyleProp<ViewStyle>;
257 labelStyle?: StyleProp<import("react-native").TextStyle>;
258 theme: ReactNativePaper.Theme;
259 testID?: string | undefined;
260 }, "color" | "onPress" | "onLongPress" | "icon" | keyof import("react-native").ViewProps | "dark" | keyof React.RefAttributes<View> | "mode" | "uppercase" | "labelStyle" | "disabled" | "compact" | "loading" | "contentStyle">) & {
261 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
262 }) | React.PropsWithChildren<(Pick<Pick<import("react-native").ViewProps & React.RefAttributes<View> & {
263 children: React.ReactNode;
264 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;
265 theme: ReactNativePaper.Theme;
266 }, keyof import("react-native").ViewProps | keyof React.RefAttributes<View>> & {
267 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
268 } & {
269 mode?: "text" | "outlined" | "contained" | undefined;
270 dark?: boolean | undefined;
271 compact?: boolean | undefined;
272 color?: string | undefined;
273 loading?: boolean | undefined;
274 icon?: import("./Icon").IconSource | undefined;
275 disabled?: boolean | undefined;
276 children: React.ReactNode;
277 uppercase?: boolean | undefined;
278 accessibilityLabel?: string | undefined;
279 accessibilityHint?: string | undefined;
280 onPress?: (() => void) | undefined;
281 onLongPress?: (() => void) | undefined;
282 contentStyle?: StyleProp<ViewStyle>;
283 style?: StyleProp<ViewStyle>;
284 labelStyle?: StyleProp<import("react-native").TextStyle>;
285 theme: ReactNativePaper.Theme;
286 testID?: string | undefined;
287 }, "color" | "onPress" | "onLongPress" | "icon" | keyof import("react-native").ViewProps | "dark" | keyof React.RefAttributes<View> | "mode" | "uppercase" | "labelStyle" | "disabled" | "compact" | "loading" | "contentStyle"> | Pick<Pick<import("react-native").ViewProps & React.RefAttributes<View> & {
288 children: React.ReactNode;
289 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;
290 theme: ReactNativePaper.Theme;
291 }, keyof import("react-native").ViewProps | keyof React.RefAttributes<View>> & {
292 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
293 } & {
294 children?: React.ReactNode;
295 } & {
296 mode?: "text" | "outlined" | "contained" | undefined;
297 dark?: boolean | undefined;
298 compact?: boolean | undefined;
299 color?: string | undefined;
300 loading?: boolean | undefined;
301 icon?: import("./Icon").IconSource | undefined;
302 disabled?: boolean | undefined;
303 children: React.ReactNode;
304 uppercase?: boolean | undefined;
305 accessibilityLabel?: string | undefined;
306 accessibilityHint?: string | undefined;
307 onPress?: (() => void) | undefined;
308 onLongPress?: (() => void) | undefined;
309 contentStyle?: StyleProp<ViewStyle>;
310 style?: StyleProp<ViewStyle>;
311 labelStyle?: StyleProp<import("react-native").TextStyle>;
312 theme: ReactNativePaper.Theme;
313 testID?: string | undefined;
314 }, "color" | "onPress" | "onLongPress" | "icon" | keyof import("react-native").ViewProps | "dark" | keyof React.RefAttributes<View> | "mode" | "uppercase" | "labelStyle" | "disabled" | "compact" | "loading" | "contentStyle">) & {
315 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
316 }>, "children"> & {
317 label: string;
318 }) | undefined;
319 /**
320 * The duration for which the Snackbar is shown.
321 */
322 duration?: number | undefined;
323 /**
324 * Callback called when Snackbar is dismissed. The `visible` prop needs to be updated when this is called.
325 */
326 onDismiss: () => void;
327 /**
328 * Text content of the Snackbar.
329 */
330 children: React.ReactNode;
331 /**
332 * Style for the wrapper of the snackbar
333 */
334 wrapperStyle?: StyleProp<ViewStyle>;
335 style?: StyleProp<ViewStyle>;
336 ref?: React.RefObject<View> | undefined;
337 /**
338 * @optional
339 */
340 theme: ReactNativePaper.Theme;
341}, "visible" | keyof import("react-native").ViewProps | keyof React.RefAttributes<View> | "onDismiss" | "action" | "duration" | "wrapperStyle">) & {
342 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
343}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<SnackbarProps> & {
344 ({ visible, action, duration, onDismiss, children, wrapperStyle, style, theme, ...rest }: SnackbarProps): JSX.Element | null;
345 /**
346 * Show the Snackbar for a short duration.
347 */
348 DURATION_SHORT: number;
349 /**
350 * Show the Snackbar for a medium duration.
351 */
352 DURATION_MEDIUM: number;
353 /**
354 * Show the Snackbar for a long duration.
355 */
356 DURATION_LONG: number;
357}, {}>;
358export default _default;