diff --git a/Libraries/Components/View/ViewPropTypes.js b/Libraries/Components/View/ViewPropTypes.js index 1d5f193c62de9e..addbc6e7e81db6 100644 --- a/Libraries/Components/View/ViewPropTypes.js +++ b/Libraries/Components/View/ViewPropTypes.js @@ -35,7 +35,43 @@ const stylePropType = StyleSheetPropType(ViewStylePropTypes); export type ViewLayout = Layout; export type ViewLayoutEvent = LayoutEvent; +type DirectEventProps = $ReadOnly<{| + onAccessibilityAction?: Function, + onAccessibilityTap?: Function, + onLayout?: ?(event: LayoutEvent) => void, + onMagicTap?: Function, +|}>; + +type TouchEventProps = $ReadOnly<{| + onTouchCancel?: ?Function, + onTouchCancelCapture?: ?Function, + onTouchEnd?: ?Function, + onTouchEndCapture?: ?Function, + onTouchMove?: ?Function, + onTouchMoveCapture?: ?Function, + onTouchStart?: ?Function, + onTouchStartCapture?: ?Function, +|}>; + +type GestureResponderEventProps = $ReadOnly<{| + onMoveShouldSetResponder?: ?Function, + onMoveShouldSetResponderCapture?: ?Function, + onResponderGrant?: ?Function, + onResponderMove?: ?Function, + onResponderReject?: ?Function, + onResponderRelease?: ?Function, + onResponderStart?: ?Function, + onResponderTerminate?: ?Function, + onResponderTerminationRequest?: ?Function, + onStartShouldSetResponder?: ?Function, + onStartShouldSetResponderCapture?: ?Function, +|}>; + export type ViewProps = $ReadOnly<{| + ...DirectEventProps, + ...GestureResponderEventProps, + ...TouchEventProps, + // There's no easy way to create a different type if (Platform.isTVOS): // so we must include TVViewProps ...TVViewProps, @@ -55,22 +91,8 @@ export type ViewProps = $ReadOnly<{| accessibilityViewIsModal?: boolean, accessibilityElementsHidden?: boolean, children?: ?React.Node, - onAccessibilityAction?: Function, - onAccessibilityTap?: Function, - onMagicTap?: Function, testID?: ?string, nativeID?: string, - onLayout?: ?(event: LayoutEvent) => void, - onResponderGrant?: ?Function, - onResponderMove?: ?Function, - onResponderReject?: ?Function, - onResponderRelease?: ?Function, - onResponderTerminate?: ?Function, - onResponderTerminationRequest?: ?Function, - onStartShouldSetResponder?: ?Function, - onStartShouldSetResponderCapture?: ?Function, - onMoveShouldSetResponder?: ?Function, - onMoveShouldSetResponderCapture?: ?Function, hitSlop?: ?EdgeInsetsProp, pointerEvents?: null | 'box-none' | 'none' | 'box-only' | 'auto', style?: stylePropType,