1 | import * as React from 'react';
|
2 | import { Animated, StyleProp, ViewStyle } from 'react-native';
|
3 | import type { ThemeProp } from '../types';
|
4 | export type Props = {
|
5 | /**
|
6 | * Determines whether clicking outside the modal 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 modal.
|
15 | */
|
16 | onDismiss?: () => void;
|
17 | /**
|
18 | * Accessibility label for the overlay. This is read by the screen reader when the user taps outside the modal.
|
19 | */
|
20 | overlayAccessibilityLabel?: string;
|
21 | /**
|
22 | * Determines Whether the modal is visible.
|
23 | */
|
24 | visible: boolean;
|
25 | /**
|
26 | * Content of the `Modal`.
|
27 | */
|
28 | children: React.ReactNode;
|
29 | /**
|
30 | * Style for the content of the modal
|
31 | */
|
32 | contentContainerStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
33 | /**
|
34 | * Style for the wrapper of the modal.
|
35 | * Use this prop to change the default wrapper style or to override safe area insets with marginTop and marginBottom.
|
36 | */
|
37 | style?: StyleProp<ViewStyle>;
|
38 | /**
|
39 | * @optional
|
40 | */
|
41 | theme?: ThemeProp;
|
42 | /**
|
43 | * testID to be used on tests.
|
44 | */
|
45 | testID?: string;
|
46 | };
|
47 | /**
|
48 | * The Modal component is a simple way to present content above an enclosing view.
|
49 | * To render the `Modal` above other components, you'll need to wrap it with the [`Portal`](./Portal) component.
|
50 | *
|
51 | * ## Usage
|
52 | * ```js
|
53 | * import * as React from 'react';
|
54 | * import { Modal, Portal, Text, Button, PaperProvider } from 'react-native-paper';
|
55 | *
|
56 | * const MyComponent = () => {
|
57 | * const [visible, setVisible] = React.useState(false);
|
58 | *
|
59 | * const showModal = () => setVisible(true);
|
60 | * const hideModal = () => setVisible(false);
|
61 | * const containerStyle = {backgroundColor: 'white', padding: 20};
|
62 | *
|
63 | * return (
|
64 | * <PaperProvider>
|
65 | * <Portal>
|
66 | * <Modal visible={visible} onDismiss={hideModal} contentContainerStyle={containerStyle}>
|
67 | * <Text>Example Modal. Click outside this area to dismiss.</Text>
|
68 | * </Modal>
|
69 | * </Portal>
|
70 | * <Button style={{marginTop: 30}} onPress={showModal}>
|
71 | * Show
|
72 | * </Button>
|
73 | * </PaperProvider>
|
74 | * );
|
75 | * };
|
76 | *
|
77 | * export default MyComponent;
|
78 | * ```
|
79 | */
|
80 | declare function Modal({ dismissable, dismissableBackButton, visible, overlayAccessibilityLabel, onDismiss, children, contentContainerStyle, style, theme: themeOverrides, testID, }: Props): React.JSX.Element | null;
|
81 | export default Modal;
|
82 | //# sourceMappingURL=Modal.d.ts.map |
\ | No newline at end of file |