Skip to content

Commit f1316ca

Browse files
elicwhitefacebook-github-bot
authored andcommitted
Making values optional in ViewPropTypes
Reviewed By: yungsters Differential Revision: D7209560 fbshipit-source-id: fd0c55c4f69648927380d12ad9a6b9bcb98047eb
1 parent 2520c64 commit f1316ca

File tree

1 file changed

+18
-25
lines changed

1 file changed

+18
-25
lines changed

Libraries/Components/View/ViewPropTypes.js

+18-25
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
'use strict';
1111

12+
const React = require('React');
1213
const EdgeInsetsPropType = require('EdgeInsetsPropType');
1314
const PlatformViewPropTypes = require('PlatformViewPropTypes');
1415
const PropTypes = require('prop-types');
@@ -26,21 +27,12 @@ import type {
2627
} from 'ViewAccessibility';
2728
import type {EdgeInsetsProp} from 'EdgeInsetsPropType';
2829
import type {TVViewProps} from 'TVViewPropTypes';
30+
import type {Layout, LayoutEvent} from 'CoreEventTypes';
2931

3032
const stylePropType = StyleSheetPropType(ViewStylePropTypes);
3133

32-
export type ViewLayout = {
33-
x: number,
34-
y: number,
35-
width: number,
36-
height: number,
37-
}
38-
39-
export type ViewLayoutEvent = {
40-
nativeEvent: {
41-
layout: ViewLayout,
42-
}
43-
}
34+
export type ViewLayout = Layout;
35+
export type ViewLayoutEvent = LayoutEvent;
4436

4537
// There's no easy way to create a different type if (Platform.isTVOS):
4638
// so we must include TVViewProps
@@ -54,23 +46,24 @@ export type ViewProps = {
5446
accessibilityTraits?: AccessibilityTrait | Array<AccessibilityTrait>,
5547
accessibilityViewIsModal?: bool,
5648
accessibilityElementsHidden?: bool,
49+
children?: ?React.Node,
5750
onAccessibilityAction?: Function,
5851
onAccessibilityTap?: Function,
5952
onMagicTap?: Function,
60-
testID?: string,
53+
testID?: ?string,
6154
nativeID?: string,
62-
onLayout?: (event: ViewLayoutEvent) => void,
63-
onResponderGrant?: Function,
64-
onResponderMove?: Function,
65-
onResponderReject?: Function,
66-
onResponderRelease?: Function,
67-
onResponderTerminate?: Function,
68-
onResponderTerminationRequest?: Function,
69-
onStartShouldSetResponder?: Function,
70-
onStartShouldSetResponderCapture?: Function,
71-
onMoveShouldSetResponder?: Function,
72-
onMoveShouldSetResponderCapture?: Function,
73-
hitSlop?: EdgeInsetsProp,
55+
onLayout?: ?(event: LayoutEvent) => void,
56+
onResponderGrant?: ?Function,
57+
onResponderMove?: ?Function,
58+
onResponderReject?: ?Function,
59+
onResponderRelease?: ?Function,
60+
onResponderTerminate?: ?Function,
61+
onResponderTerminationRequest?: ?Function,
62+
onStartShouldSetResponder?: ?Function,
63+
onStartShouldSetResponderCapture?: ?Function,
64+
onMoveShouldSetResponder?: ?Function,
65+
onMoveShouldSetResponderCapture?: ?Function,
66+
hitSlop?: ?EdgeInsetsProp,
7467
pointerEvents?: null | 'box-none'| 'none'| 'box-only'| 'auto',
7568
style?: stylePropType,
7669
removeClippedSubviews?: bool,

0 commit comments

Comments
 (0)