-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
Copy pathpropTypes.js
68 lines (51 loc) · 2.75 KB
/
propTypes.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
import PropTypes from 'prop-types';
import stylePropTypes from '@styles/stylePropTypes';
const propTypes = {
/** Array of additional styles to add */
style: PropTypes.arrayOf(PropTypes.object),
/** Returns a function as a child to pass insets to or a node to render without insets */
children: PropTypes.oneOfType([PropTypes.node, PropTypes.func]).isRequired,
/** A unique ID to find the screen wrapper in tests */
testID: PropTypes.string.isRequired,
/** Whether to include padding bottom */
includeSafeAreaPaddingBottom: PropTypes.bool,
/** Whether to include padding top */
includePaddingTop: PropTypes.bool,
/** Called when navigated Screen's transition is finished. It does not fire when user exit the page. */
onEntryTransitionEnd: PropTypes.func,
/** The behavior to pass to the KeyboardAvoidingView, requires some trial and error depending on the layout/devices used.
* Search 'switch(behavior)' in ./node_modules/react-native/Libraries/Components/Keyboard/KeyboardAvoidingView.js for more context */
keyboardAvoidingViewBehavior: PropTypes.oneOf(['padding', 'height', 'position']),
/** Whether KeyboardAvoidingView should be enabled. Use false for screens where this functionality is not necessary */
shouldEnableKeyboardAvoidingView: PropTypes.bool,
/** Whether picker modal avoiding should be enabled. Should be enabled when there's a picker at the bottom of a
* scrollable form, gives a subtly better UX if disabled on non-scrollable screens with a submit button */
shouldEnablePickerAvoiding: PropTypes.bool,
/** Whether to dismiss keyboard before leaving a screen */
shouldDismissKeyboardBeforeClose: PropTypes.bool,
/** Whether to use the maxHeight (true) or use the 100% of the height (false) */
shouldEnableMaxHeight: PropTypes.bool,
/** Whether to use the minHeight. Use true for screens where the window height are changing because of Virtual Keyboard */
shouldEnableMinHeight: PropTypes.bool,
/** Array of additional styles for header gap */
headerGapStyles: PropTypes.arrayOf(PropTypes.object),
/** Whether to show offline indicator */
shouldShowOfflineIndicator: PropTypes.bool,
/** Styles for the offline indicator */
offlineIndicatorStyle: stylePropTypes,
};
const defaultProps = {
style: [],
includeSafeAreaPaddingBottom: true,
shouldDismissKeyboardBeforeClose: true,
includePaddingTop: true,
onEntryTransitionEnd: () => {},
keyboardAvoidingViewBehavior: 'padding',
shouldEnableKeyboardAvoidingView: true,
shouldEnableMaxHeight: false,
shouldEnablePickerAvoiding: true,
shouldShowOfflineIndicator: true,
offlineIndicatorStyle: [],
headerGapStyles: [],
};
export {propTypes, defaultProps};