UNPKG

3.63 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';
13import {ColorValue} from '../StyleSheet/StyleSheet';
14
15export interface ModalBaseProps {
16 /**
17 * @deprecated Use animationType instead
18 */
19 animated?: boolean | undefined;
20 /**
21 * The `animationType` prop controls how the modal animates.
22 *
23 * - `slide` slides in from the bottom
24 * - `fade` fades into view
25 * - `none` appears without an animation
26 */
27 animationType?: 'none' | 'slide' | 'fade' | undefined;
28 /**
29 * The `transparent` prop determines whether your modal will fill the entire view.
30 * Setting this to `true` will render the modal over a transparent background.
31 */
32 transparent?: boolean | undefined;
33 /**
34 * The `visible` prop determines whether your modal is visible.
35 */
36 visible?: boolean | undefined;
37 /**
38 * The `onRequestClose` callback is called when the user taps the hardware back button on Android or the menu button on Apple TV.
39 *
40 * This is required on Apple TV and Android.
41 */
42 onRequestClose?: ((event: NativeSyntheticEvent<any>) => void) | undefined;
43 /**
44 * The `onShow` prop allows passing a function that will be called once the modal has been shown.
45 */
46 onShow?: ((event: NativeSyntheticEvent<any>) => void) | undefined;
47
48 /**
49 * The `backdropColor` props sets the background color of the modal's container.
50 * Defaults to `white` if not provided and transparent is `false`. Ignored if `transparent` is `true`.
51 */
52 backdropColor?: ColorValue | undefined;
53}
54
55export interface ModalPropsIOS {
56 /**
57 * The `presentationStyle` determines the style of modal to show
58 */
59 presentationStyle?:
60 | 'fullScreen'
61 | 'pageSheet'
62 | 'formSheet'
63 | 'overFullScreen'
64 | undefined;
65
66 /**
67 * The `supportedOrientations` prop allows the modal to be rotated to any of the specified orientations.
68 * On iOS, the modal is still restricted by what's specified in your app's Info.plist's UISupportedInterfaceOrientations field.
69 */
70 supportedOrientations?:
71 | Array<
72 | 'portrait'
73 | 'portrait-upside-down'
74 | 'landscape'
75 | 'landscape-left'
76 | 'landscape-right'
77 >
78 | undefined;
79
80 /**
81 * The `onDismiss` prop allows passing a function that will be called once the modal has been dismissed.
82 */
83 onDismiss?: (() => void) | undefined;
84
85 /**
86 * The `onOrientationChange` callback is called when the orientation changes while the modal is being displayed.
87 * The orientation provided is only 'portrait' or 'landscape'. This callback is also called on initial render, regardless of the current orientation.
88 */
89 onOrientationChange?:
90 | ((event: NativeSyntheticEvent<any>) => void)
91 | undefined;
92}
93
94export interface ModalPropsAndroid {
95 /**
96 * Controls whether to force hardware acceleration for the underlying window.
97 */
98 hardwareAccelerated?: boolean | undefined;
99
100 /**
101 * Determines whether your modal should go under the system statusbar.
102 */
103 statusBarTranslucent?: boolean | undefined;
104
105 /**
106 * Determines whether your modal should go under the system navigationbar.
107 */
108 navigationBarTranslucent?: boolean | undefined;
109}
110
111export type ModalProps = ModalBaseProps &
112 ModalPropsIOS &
113 ModalPropsAndroid &
114 ViewProps;
115
116export class Modal extends React.Component<ModalProps> {}
117
\No newline at end of file