UNPKG

3.09 kBTypeScriptView Raw
1import * as React from 'react';
2import { Animated, StyleProp, ViewStyle } from 'react-native';
3import type { ThemeProp } from '../../types';
4export declare type Props = {
5 /**
6 * Determines whether clicking outside the dialog dismiss it.
7 */
8 dismissable?: boolean;
9 /**
10 * Determines whether clicking Android hardware back button dismiss dialog.
11 */
12 dismissableBackButton?: boolean;
13 /**
14 * Callback that is called when the user dismisses the dialog.
15 */
16 onDismiss?: () => void;
17 /**
18 * Determines Whether the dialog is visible.
19 */
20 visible: boolean;
21 /**
22 * Content of the `Dialog`.
23 */
24 children: React.ReactNode;
25 style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
26 /**
27 * @optional
28 */
29 theme?: ThemeProp;
30 /**
31 * testID to be used on tests.
32 */
33 testID?: string;
34};
35/**
36 * Dialogs inform users about a specific task and may contain critical information, require decisions, or involve multiple tasks.
37 * To render the `Dialog` above other components, you'll need to wrap it with the [`Portal`](../../Portal) component.
38 *
39 * ## Usage
40 * ```js
41 * import * as React from 'react';
42 * import { View } from 'react-native';
43 * import { Button, Dialog, Portal, PaperProvider, Text } from 'react-native-paper';
44 *
45 * const MyComponent = () => {
46 * const [visible, setVisible] = React.useState(false);
47 *
48 * const showDialog = () => setVisible(true);
49 *
50 * const hideDialog = () => setVisible(false);
51 *
52 * return (
53 * <PaperProvider>
54 * <View>
55 * <Button onPress={showDialog}>Show Dialog</Button>
56 * <Portal>
57 * <Dialog visible={visible} onDismiss={hideDialog}>
58 * <Dialog.Title>Alert</Dialog.Title>
59 * <Dialog.Content>
60 * <Text variant="bodyMedium">This is simple dialog</Text>
61 * </Dialog.Content>
62 * <Dialog.Actions>
63 * <Button onPress={hideDialog}>Done</Button>
64 * </Dialog.Actions>
65 * </Dialog>
66 * </Portal>
67 * </View>
68 * </PaperProvider>
69 * );
70 * };
71 *
72 * export default MyComponent;
73 * ```
74 */
75declare const Dialog: {
76 ({ children, dismissable, dismissableBackButton, onDismiss, visible, style, theme: themeOverrides, testID, }: Props): React.JSX.Element;
77 Content: {
78 (props: import("./DialogContent").Props): React.JSX.Element;
79 displayName: string;
80 };
81 Actions: {
82 (props: import("./DialogActions").Props): React.JSX.Element;
83 displayName: string;
84 };
85 Title: {
86 ({ children, theme: themeOverrides, style, ...rest }: import("./DialogTitle").Props): React.JSX.Element;
87 displayName: string;
88 };
89 ScrollArea: {
90 (props: import("./DialogScrollArea").Props): React.JSX.Element;
91 displayName: string;
92 };
93 Icon: {
94 ({ size, color, icon, theme: themeOverrides, }: import("./DialogIcon").Props): React.JSX.Element | null;
95 displayName: string;
96 };
97};
98export default Dialog;
99//# sourceMappingURL=Dialog.d.ts.map
\No newline at end of file