UNPKG

6.2 kBTypeScriptView Raw
1import * as React from 'react';
2import { 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.ComponentClass<Pick<SnackbarProps, "ref" | "style" | "children" | "pointerEvents" | "onLayout" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "key" | "hitSlop" | "removeClippedSubviews" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "visible" | "onDismiss" | "action" | "duration" | "wrapperStyle"> & {
42 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
43}, any> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<(React.ComponentClass<SnackbarProps, any> & {
44 ({ visible, action, duration, onDismiss, children, wrapperStyle, style, theme, ...rest }: SnackbarProps): JSX.Element | null;
45 /**
46 * Show the Snackbar for a short duration.
47 */
48 DURATION_SHORT: number;
49 /**
50 * Show the Snackbar for a medium duration.
51 */
52 DURATION_MEDIUM: number;
53 /**
54 * Show the Snackbar for a long duration.
55 */
56 DURATION_LONG: number;
57}) | (React.FunctionComponent<SnackbarProps> & {
58 ({ visible, action, duration, onDismiss, children, wrapperStyle, style, theme, ...rest }: SnackbarProps): JSX.Element | null;
59 /**
60 * Show the Snackbar for a short duration.
61 */
62 DURATION_SHORT: number;
63 /**
64 * Show the Snackbar for a medium duration.
65 */
66 DURATION_MEDIUM: number;
67 /**
68 * Show the Snackbar for a long duration.
69 */
70 DURATION_LONG: number;
71}), {}>) | (React.FunctionComponent<Pick<SnackbarProps, "ref" | "style" | "children" | "pointerEvents" | "onLayout" | "testID" | "nativeID" | "accessible" | "accessibilityActions" | "accessibilityLabel" | "accessibilityRole" | "accessibilityState" | "accessibilityHint" | "accessibilityValue" | "onAccessibilityAction" | "accessibilityLiveRegion" | "importantForAccessibility" | "accessibilityElementsHidden" | "accessibilityViewIsModal" | "onAccessibilityEscape" | "onAccessibilityTap" | "onMagicTap" | "accessibilityIgnoresInvertColors" | "key" | "hitSlop" | "removeClippedSubviews" | "collapsable" | "needsOffscreenAlphaCompositing" | "renderToHardwareTextureAndroid" | "focusable" | "shouldRasterizeIOS" | "isTVSelectable" | "hasTVPreferredFocus" | "tvParallaxProperties" | "tvParallaxShiftDistanceX" | "tvParallaxShiftDistanceY" | "tvParallaxTiltAngle" | "tvParallaxMagnification" | "onStartShouldSetResponder" | "onMoveShouldSetResponder" | "onResponderEnd" | "onResponderGrant" | "onResponderReject" | "onResponderMove" | "onResponderRelease" | "onResponderStart" | "onResponderTerminationRequest" | "onResponderTerminate" | "onStartShouldSetResponderCapture" | "onMoveShouldSetResponderCapture" | "onTouchStart" | "onTouchMove" | "onTouchEnd" | "onTouchCancel" | "onTouchEndCapture" | "visible" | "onDismiss" | "action" | "duration" | "wrapperStyle"> & {
72 theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
73}> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<(React.ComponentClass<SnackbarProps, any> & {
74 ({ visible, action, duration, onDismiss, children, wrapperStyle, style, theme, ...rest }: SnackbarProps): JSX.Element | null;
75 /**
76 * Show the Snackbar for a short duration.
77 */
78 DURATION_SHORT: number;
79 /**
80 * Show the Snackbar for a medium duration.
81 */
82 DURATION_MEDIUM: number;
83 /**
84 * Show the Snackbar for a long duration.
85 */
86 DURATION_LONG: number;
87}) | (React.FunctionComponent<SnackbarProps> & {
88 ({ visible, action, duration, onDismiss, children, wrapperStyle, style, theme, ...rest }: SnackbarProps): JSX.Element | null;
89 /**
90 * Show the Snackbar for a short duration.
91 */
92 DURATION_SHORT: number;
93 /**
94 * Show the Snackbar for a medium duration.
95 */
96 DURATION_MEDIUM: number;
97 /**
98 * Show the Snackbar for a long duration.
99 */
100 DURATION_LONG: number;
101}), {}>);
102export default _default;