mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-22 19:48:56 +08:00
Flow TouchableWithoutFeedback (#22479)
Summary: Related to #22100 Enhance TouchableWithoutFeedback with press and target event types. There are still work to do to update `UNSAFE_componentWillReceiveProps` and `touchableGetHitSlop` to make Flow not complain about `DeprecatedEdgeInsetsPropType` inexact type. Pull Request resolved: https://github.com/facebook/react-native/pull/22479 Reviewed By: RSNara Differential Revision: D13310764 Pulled By: TheSavior fbshipit-source-id: 9002e542378491fb800c8e81c63f4fbe125b563c
This commit is contained in:
committed by
Facebook Github Bot
parent
87b6533937
commit
7e4f92bc19
@@ -26,7 +26,7 @@ const {
|
||||
DeprecatedAccessibilityTraits,
|
||||
} = require('DeprecatedViewAccessibility');
|
||||
|
||||
import type {PressEvent} from 'CoreEventTypes';
|
||||
import type {SyntheticEvent, LayoutEvent, PressEvent} from 'CoreEventTypes';
|
||||
import type {EdgeInsetsProp} from 'EdgeInsetsPropType';
|
||||
import type {
|
||||
AccessibilityComponentType,
|
||||
@@ -35,17 +35,21 @@ import type {
|
||||
AccessibilityTraits,
|
||||
} from 'ViewAccessibility';
|
||||
|
||||
type TargetEvent = SyntheticEvent<
|
||||
$ReadOnly<{|
|
||||
target: number,
|
||||
|}>,
|
||||
>;
|
||||
|
||||
type BlurEvent = TargetEvent;
|
||||
type FocusEvent = TargetEvent;
|
||||
|
||||
const PRESS_RETENTION_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||
|
||||
export type Props = $ReadOnly<{|
|
||||
accessible?: ?boolean,
|
||||
accessibilityComponentType?: ?AccessibilityComponentType,
|
||||
accessibilityLabel?:
|
||||
| null
|
||||
| React$PropType$Primitive<any>
|
||||
| string
|
||||
| Array<any>
|
||||
| any,
|
||||
accessibilityLabel?: ?Stringish,
|
||||
accessibilityHint?: ?Stringish,
|
||||
accessibilityIgnoresInvertColors?: ?boolean,
|
||||
accessibilityRole?: ?AccessibilityRole,
|
||||
@@ -58,13 +62,13 @@ export type Props = $ReadOnly<{|
|
||||
disabled?: ?boolean,
|
||||
hitSlop?: ?EdgeInsetsProp,
|
||||
nativeID?: ?string,
|
||||
onBlur?: ?Function,
|
||||
onFocus?: ?Function,
|
||||
onLayout?: ?Function,
|
||||
onLongPress?: ?Function,
|
||||
onPress?: ?Function,
|
||||
onPressIn?: ?Function,
|
||||
onPressOut?: ?Function,
|
||||
onBlur?: ?(e: BlurEvent) => void,
|
||||
onFocus?: ?(e: FocusEvent) => void,
|
||||
onLayout?: ?(event: LayoutEvent) => mixed,
|
||||
onLongPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
pressRetentionOffset?: ?EdgeInsetsProp,
|
||||
rejectResponderTermination?: ?boolean,
|
||||
testID?: ?string,
|
||||
|
||||
Reference in New Issue
Block a user