import * as React from "react"; import { StyleProp, ViewStyle, View } from "react-native"; import { DefaultTheme } from "styled-components"; import Surface from "../Surface"; declare type Props = React.ComponentProps & { /** * Whether the Snackbar is currently visible. */ visible: boolean; /** * Label and press callback for the action button. It should contain the following properties: * - `label` - Label of the action button * - `onPress` - Callback that is called when action button is pressed. */ action?: { label: string; accessibilityLabel?: string; onPress: () => void; }; /** * The duration for which the Snackbar is shown. */ duration?: number; /** * Callback called when Snackbar is dismissed. The `visible` prop needs to be updated when this is called. */ onDismiss: () => void; /** * Text content of the Snackbar. */ children: React.ReactNode; /** * Style for the wrapper of the snackbar */ wrapperStyle?: StyleProp; style?: StyleProp; ref?: React.RefObject; /** * @optional */ theme?: DefaultTheme; }; /** * Snackbars provide brief feedback about an operation through a message at the bottom of the screen. * Snackbar by default uses `onSurface` color from theme. *
* *
* * ## Usage * ```js * import * as React from 'react'; * import { View, StyleSheet } from 'react-native'; * import Button from 'react-native-simple-elements/components/Button'; * import Snackbar from "react-native-simple-elements/components/Snackbar" * * const MyComponent = () => { * const [visible, setVisible] = React.useState(false); * * const onToggleSnackBar = () => setVisible(!visible); * * const onDismissSnackBar = () => setVisible(false); * * return ( * * * { * // Do something * }, * }}> * Hey there! I'm a Snackbar. * * * ); * }; * * const styles = StyleSheet.create({ * container: { * flex: 1, * justifyContent: 'space-between', * }, * }); * * export default MyComponent; * ``` */ declare const Snackbar: { ({ visible, action, duration, onDismiss, children, wrapperStyle, style, ...rest }: Props): JSX.Element; /** * Show the Snackbar for a short duration. */ DURATION_SHORT: number; /** * Show the Snackbar for a medium duration. */ DURATION_MEDIUM: number; /** * Show the Snackbar for a long duration. */ DURATION_LONG: number; }; export default Snackbar;