UNPKG

3.2 kBTypeScriptView Raw
1/**
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @format
8 */
9
10import type * as React from 'react';
11import {ViewProps} from '../Components/View/ViewPropTypes';
12import {NativeSyntheticEvent} from '../Types/CoreEventTypes';
13
14export interface ModalBaseProps {
15 /**
16 * @deprecated Use animationType instead
17 */
18 animated?: boolean | undefined;
19 /**
20 * The `animationType` prop controls how the modal animates.
21 *
22 * - `slide` slides in from the bottom
23 * - `fade` fades into view
24 * - `none` appears without an animation
25 */
26 animationType?: 'none' | 'slide' | 'fade' | undefined;
27 /**
28 * The `transparent` prop determines whether your modal will fill the entire view.
29 * Setting this to `true` will render the modal over a transparent background.
30 */
31 transparent?: boolean | undefined;
32 /**
33 * The `visible` prop determines whether your modal is visible.
34 */
35 visible?: boolean | undefined;
36 /**
37 * The `onRequestClose` callback is called when the user taps the hardware back button on Android or the menu button on Apple TV.
38 *
39 * This is required on Apple TV and Android.
40 */
41 onRequestClose?: ((event: NativeSyntheticEvent<any>) => void) | undefined;
42 /**
43 * The `onShow` prop allows passing a function that will be called once the modal has been shown.
44 */
45 onShow?: ((event: NativeSyntheticEvent<any>) => void) | undefined;
46}
47
48export interface ModalPropsIOS {
49 /**
50 * The `presentationStyle` determines the style of modal to show
51 */
52 presentationStyle?:
53 | 'fullScreen'
54 | 'pageSheet'
55 | 'formSheet'
56 | 'overFullScreen'
57 | undefined;
58
59 /**
60 * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations.
61 * On iOS, the modal is still restricted by what's specified in your app's Info.plist's UISupportedInterfaceOrientations field.
62 */
63 supportedOrientations?:
64 | Array<
65 | 'portrait'
66 | 'portrait-upside-down'
67 | 'landscape'
68 | 'landscape-left'
69 | 'landscape-right'
70 >
71 | undefined;
72
73 /**
74 * The `onDismiss` prop allows passing a function that will be called once the modal has been dismissed.
75 */
76 onDismiss?: (() => void) | undefined;
77
78 /**
79 * The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed.
80 * The orientation provided is only 'portrait' or 'landscape'. This callback is also called on initial render, regardless of the current orientation.
81 */
82 onOrientationChange?:
83 | ((event: NativeSyntheticEvent<any>) => void)
84 | undefined;
85}
86
87export interface ModalPropsAndroid {
88 /**
89 * Controls whether to force hardware acceleration for the underlying window.
90 */
91 hardwareAccelerated?: boolean | undefined;
92
93 /**
94 * Determines whether your modal should go under the system statusbar.
95 */
96 statusBarTranslucent?: boolean | undefined;
97}
98
99export type ModalProps = ModalBaseProps &
100 ModalPropsIOS &
101 ModalPropsAndroid &
102 ViewProps;
103
104export class Modal extends React.Component<ModalProps> {}
105
\No newline at end of file