1 | import * as React from 'react';
|
2 | import { StyleProp, ViewStyle } from 'react-native';
|
3 | declare type Props = {
|
4 | /**
|
5 | * Determines whether clicking outside the modal dismiss it.
|
6 | */
|
7 | dismissable?: boolean;
|
8 | /**
|
9 | * Callback that is called when the user dismisses the modal.
|
10 | */
|
11 | onDismiss?: () => void;
|
12 | /**
|
13 | * Accessibility label for the overlay. This is read by the screen reader when the user taps outside the modal.
|
14 | */
|
15 | overlayAccessibilityLabel?: string;
|
16 | /**
|
17 | * Determines Whether the modal is visible.
|
18 | */
|
19 | visible: boolean;
|
20 | /**
|
21 | * Content of the `Modal`.
|
22 | */
|
23 | children: React.ReactNode;
|
24 | /**
|
25 | * Style for the content of the modal
|
26 | */
|
27 | contentContainerStyle?: StyleProp<ViewStyle>;
|
28 | /**
|
29 | * Style for the wrapper of the modal.
|
30 | * Use this prop to change the default wrapper style or to override safe area insets with marginTop and marginBottom.
|
31 | */
|
32 | style?: StyleProp<ViewStyle>;
|
33 | /**
|
34 | * @optional
|
35 | */
|
36 | theme: ReactNativePaper.Theme;
|
37 | testID?: string;
|
38 | };
|
39 | /**
|
40 | * The Modal component is a simple way to present content above an enclosing view.
|
41 | * To render the `Modal` above other components, you'll need to wrap it with the [`Portal`](portal.html) component.
|
42 | *
|
43 | * <div class="screenshots">
|
44 | * <figure>
|
45 | * <img class="medium" src="screenshots/modal.gif" />
|
46 | * </figure>
|
47 | * </div>
|
48 | *
|
49 | * ## Usage
|
50 | * ```js
|
51 | * import * as React from 'react';
|
52 | * import { Modal, Portal, Text, Button, Provider } from 'react-native-paper';
|
53 | *
|
54 | * const MyComponent = () => {
|
55 | * const [visible, setVisible] = React.useState(false);
|
56 | *
|
57 | * const showModal = () => setVisible(true);
|
58 | * const hideModal = () => setVisible(false);
|
59 | * const containerStyle = {backgroundColor: 'white', padding: 20};
|
60 | *
|
61 | * return (
|
62 | * <Provider>
|
63 | * <Portal>
|
64 | * <Modal visible={visible} onDismiss={hideModal} contentContainerStyle={containerStyle}>
|
65 | * <Text>Example Modal. Click outside this area to dismiss.</Text>
|
66 | * </Modal>
|
67 | * </Portal>
|
68 | * <Button style={{marginTop: 30}} onPress={showModal}>
|
69 | * Show
|
70 | * </Button>
|
71 | * </Provider>
|
72 | * );
|
73 | * };
|
74 | *
|
75 | * export default MyComponent;
|
76 | * ```
|
77 | */
|
78 | declare function Modal({ dismissable, visible, overlayAccessibilityLabel, onDismiss, children, contentContainerStyle, style, theme, testID, }: Props): JSX.Element | null;
|
79 | declare const _default: React.ComponentType<Pick<Props, "style" | "children" | "testID" | "visible" | "contentContainerStyle" | "onDismiss" | "overlayAccessibilityLabel" | "dismissable"> & {
|
80 | theme?: import("@callstack/react-theme-provider").$DeepPartial<ReactNativePaper.Theme> | undefined;
|
81 | }> & import("@callstack/react-theme-provider/typings/hoist-non-react-statics").NonReactStatics<React.ComponentType<Props> & typeof Modal, {}>;
|
82 | export default _default;
|