diff --git a/Libraries/Components/View/ViewPropTypes.js b/Libraries/Components/View/ViewPropTypes.js index 4a923cd464..70022b5aca 100644 --- a/Libraries/Components/View/ViewPropTypes.js +++ b/Libraries/Components/View/ViewPropTypes.js @@ -10,7 +10,14 @@ 'use strict'; -import type {PressEvent, Layout, LayoutEvent} from '../../Types/CoreEventTypes'; +import type { + BlurEvent, + FocusEvent, + MouseEvent, + PressEvent, + Layout, + LayoutEvent, +} from '../../Types/CoreEventTypes'; import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType'; import type {Node} from 'react'; import type {ViewStyleProp} from '../../StyleSheet/StyleSheet'; @@ -25,13 +32,18 @@ import type { export type ViewLayout = Layout; export type ViewLayoutEvent = LayoutEvent; +type BubblingEventProps = $ReadOnly<{| + onBlur?: ?(event: BlurEvent) => mixed, + onFocus?: ?(event: FocusEvent) => mixed, +|}>; + type DirectEventProps = $ReadOnly<{| /** * When `accessible` is true, the system will try to invoke this function * when the user performs an accessibility custom action. * */ - onAccessibilityAction?: ?(event: AccessibilityActionEvent) => void, + onAccessibilityAction?: ?(event: AccessibilityActionEvent) => mixed, /** * When `accessible` is true, the system will try to invoke this function @@ -39,7 +51,7 @@ type DirectEventProps = $ReadOnly<{| * * See http://facebook.github.io/react-native/docs/view.html#onaccessibilitytap */ - onAccessibilityTap?: ?() => void, + onAccessibilityTap?: ?() => mixed, /** * Invoked on mount and layout changes with: @@ -60,7 +72,7 @@ type DirectEventProps = $ReadOnly<{| * * See http://facebook.github.io/react-native/docs/view.html#onmagictap */ - onMagicTap?: ?() => void, + onMagicTap?: ?() => mixed, /** * When `accessible` is `true`, the system will invoke this function when the @@ -68,7 +80,12 @@ type DirectEventProps = $ReadOnly<{| * * See http://facebook.github.io/react-native/docs/view.html#onaccessibilityescape */ - onAccessibilityEscape?: ?() => void, + onAccessibilityEscape?: ?() => mixed, +|}>; + +type MouseEventProps = $ReadOnly<{| + onMouseEnter?: (event: MouseEvent) => void, + onMouseLeave?: (event: MouseEvent) => void, |}>; type TouchEventProps = $ReadOnly<{| @@ -279,7 +296,7 @@ type AndroidViewProps = $ReadOnly<{| * * @platform android */ - hasTVPreferredFocus?: boolean, + hasTVPreferredFocus?: ?boolean, /** * TV next focus down (see documentation for the View component). @@ -328,7 +345,7 @@ type AndroidViewProps = $ReadOnly<{| * * @platform android */ - onClick?: () => void, + onClick?: ?(event: PressEvent) => mixed, |}>; type IOSViewProps = $ReadOnly<{| @@ -371,8 +388,10 @@ type IOSViewProps = $ReadOnly<{| |}>; export type ViewProps = $ReadOnly<{| + ...BubblingEventProps, ...DirectEventProps, ...GestureResponderEventProps, + ...MouseEventProps, ...TouchEventProps, ...AndroidViewProps, ...IOSViewProps,