-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathmodalPropTypes.js
89 lines (69 loc) · 2.89 KB
/
modalPropTypes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
import PropTypes from 'prop-types';
import _ from 'underscore';
import {windowDimensionsPropTypes} from '@components/withWindowDimensions';
import stylePropTypes from '@styles/stylePropTypes';
import CONST from '@src/CONST';
const propTypes = {
/** Decides whether the modal should cover fullscreen. FullScreen modal has backdrop */
fullscreen: PropTypes.bool,
/** Should we close modal on outside click */
shouldCloseOnOutsideClick: PropTypes.bool,
/** Should we announce the Modal visibility changes? */
shouldSetModalVisibility: PropTypes.bool,
/** Callback method fired when the user requests to close the modal */
onClose: PropTypes.func.isRequired,
/** State that determines whether to display the modal or not */
isVisible: PropTypes.bool.isRequired,
/** Modal contents */
children: PropTypes.node.isRequired,
/** Callback method fired when the user requests to submit the modal content. */
onSubmit: PropTypes.func,
/** Callback method fired when the modal is hidden */
onModalHide: PropTypes.func,
/** Callback method fired when the modal is shown */
onModalShow: PropTypes.func,
/** Style of modal to display */
type: PropTypes.oneOf(_.values(CONST.MODAL.MODAL_TYPE)),
/** A react-native-animatable animation definition for the modal display animation. */
animationIn: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
/** A react-native-animatable animation definition for the modal hide animation. */
animationOut: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),
/** The anchor position of a popover modal. Has no effect on other modal types. */
popoverAnchorPosition: PropTypes.shape({
top: PropTypes.number,
right: PropTypes.number,
bottom: PropTypes.number,
left: PropTypes.number,
}),
/** Modal container styles */
innerContainerStyle: stylePropTypes,
/** Whether the modal should go under the system statusbar */
statusBarTranslucent: PropTypes.bool,
/** Whether the modal should avoid the keyboard */
avoidKeyboard: PropTypes.bool,
/**
* Whether the modal should hide its content while animating. On iOS, set to true
* if `useNativeDriver` is also true, to avoid flashes in the UI.
*
* See: https://github.com/react-native-modal/react-native-modal/pull/116
* */
hideModalContentWhileAnimating: PropTypes.bool,
...windowDimensionsPropTypes,
};
const defaultProps = {
fullscreen: true,
shouldCloseOnOutsideClick: false,
shouldSetModalVisibility: true,
onSubmit: null,
type: '',
onModalHide: () => {},
onModalShow: () => {},
animationIn: null,
animationOut: null,
popoverAnchorPosition: {},
innerContainerStyle: {},
statusBarTranslucent: true,
avoidKeyboard: false,
hideModalContentWhileAnimating: false,
};
export {propTypes, defaultProps};