mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Align press and scroll events with OSS (#49424)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49424 Changelog: [Internal] Reviewed By: huntie Differential Revision: D69655561 fbshipit-source-id: c36036a2abb43dd75c41582f2a27e7f9d3509044
This commit is contained in:
committed by
Facebook GitHub Bot
parent
1705f96322
commit
bae8955000
+1
-1
File diff suppressed because one or more lines are too long
@@ -10,7 +10,7 @@
|
||||
|
||||
import type {RefObject} from 'react';
|
||||
import type {HostInstance} from 'react-native';
|
||||
import type {SyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
import type {NativeSyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
|
||||
import PopupMenuAndroidNativeComponent, {
|
||||
Commands,
|
||||
@@ -19,13 +19,13 @@ import nullthrows from 'nullthrows';
|
||||
import * as React from 'react';
|
||||
import {useCallback, useImperativeHandle, useRef} from 'react';
|
||||
|
||||
type PopupMenuSelectionEvent = SyntheticEvent<
|
||||
type PopupMenuSelectionEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
item: number,
|
||||
}>,
|
||||
>;
|
||||
|
||||
type PopupMenuDismissEvent = SyntheticEvent<$ReadOnly<{}>>;
|
||||
type PopupMenuDismissEvent = NativeSyntheticEvent<$ReadOnly<{}>>;
|
||||
|
||||
export type PopupMenuAndroidInstance = {
|
||||
+show: () => void,
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
import type {TextStyleProp, ViewStyleProp} from '../StyleSheet/StyleSheet';
|
||||
import type {PressEvent} from '../Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../Types/CoreEventTypes';
|
||||
import type {
|
||||
AccessibilityActionEvent,
|
||||
AccessibilityActionInfo,
|
||||
@@ -36,9 +36,9 @@ type ButtonProps = $ReadOnly<{
|
||||
|
||||
/**
|
||||
Handler to be called when the user taps the button. The first function
|
||||
argument is an event in form of [PressEvent](pressevent).
|
||||
argument is an event in form of [GestureResponderEvent](pressevent).
|
||||
*/
|
||||
onPress: (event?: PressEvent) => mixed,
|
||||
onPress: (event?: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
If `true`, doesn't play system sound on touch.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
import type {
|
||||
LayoutChangeEvent,
|
||||
MouseEvent,
|
||||
PressEvent,
|
||||
GestureResponderEvent,
|
||||
} from '../../Types/CoreEventTypes';
|
||||
import type {
|
||||
AccessibilityActionEvent,
|
||||
@@ -141,22 +141,22 @@ type Props = $ReadOnly<{
|
||||
/**
|
||||
* Called when a long-tap gesture is detected.
|
||||
*/
|
||||
onLongPress?: ?(event: PressEvent) => mixed,
|
||||
onLongPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Called when a single tap gesture is detected.
|
||||
*/
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Called when a touch is engaged before `onPress`.
|
||||
*/
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Called when a touch is released before `onPress`.
|
||||
*/
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Either view styles or a function that receives a boolean reflecting whether
|
||||
@@ -299,7 +299,7 @@ function Pressable(
|
||||
onHoverOut,
|
||||
onLongPress,
|
||||
onPress,
|
||||
onPressIn(event: PressEvent): void {
|
||||
onPressIn(event: GestureResponderEvent): void {
|
||||
if (android_rippleConfig != null) {
|
||||
android_rippleConfig.onPressIn(event);
|
||||
}
|
||||
@@ -309,7 +309,7 @@ function Pressable(
|
||||
}
|
||||
},
|
||||
onPressMove: android_rippleConfig?.onPressMove,
|
||||
onPressOut(event: PressEvent): void {
|
||||
onPressOut(event: GestureResponderEvent): void {
|
||||
if (android_rippleConfig != null) {
|
||||
android_rippleConfig.onPressOut(event);
|
||||
}
|
||||
|
||||
+7
-7
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
||||
import type {PressEvent} from '../../Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../../Types/CoreEventTypes';
|
||||
|
||||
import processColor from '../../StyleSheet/processColor';
|
||||
import Platform from '../../Utilities/Platform';
|
||||
@@ -41,9 +41,9 @@ export default function useAndroidRippleForView(
|
||||
rippleConfig: ?RippleConfig,
|
||||
viewRef: {current: null | React.ElementRef<typeof View>},
|
||||
): ?$ReadOnly<{
|
||||
onPressIn: (event: PressEvent) => void,
|
||||
onPressMove: (event: PressEvent) => void,
|
||||
onPressOut: (event: PressEvent) => void,
|
||||
onPressIn: (event: GestureResponderEvent) => void,
|
||||
onPressMove: (event: GestureResponderEvent) => void,
|
||||
onPressOut: (event: GestureResponderEvent) => void,
|
||||
viewProps:
|
||||
| $ReadOnly<{nativeBackgroundAndroid: NativeBackgroundProp}>
|
||||
| $ReadOnly<{nativeForegroundAndroid: NativeBackgroundProp}>,
|
||||
@@ -75,7 +75,7 @@ export default function useAndroidRippleForView(
|
||||
{nativeForegroundAndroid: nativeRippleValue}
|
||||
: // $FlowFixMe[incompatible-return]
|
||||
{nativeBackgroundAndroid: nativeRippleValue},
|
||||
onPressIn(event: PressEvent): void {
|
||||
onPressIn(event: GestureResponderEvent): void {
|
||||
const view = viewRef.current;
|
||||
if (view != null) {
|
||||
Commands.hotspotUpdate(
|
||||
@@ -86,7 +86,7 @@ export default function useAndroidRippleForView(
|
||||
Commands.setPressed(view, true);
|
||||
}
|
||||
},
|
||||
onPressMove(event: PressEvent): void {
|
||||
onPressMove(event: GestureResponderEvent): void {
|
||||
const view = viewRef.current;
|
||||
if (view != null) {
|
||||
Commands.hotspotUpdate(
|
||||
@@ -96,7 +96,7 @@ export default function useAndroidRippleForView(
|
||||
);
|
||||
}
|
||||
},
|
||||
onPressOut(event: PressEvent): void {
|
||||
onPressOut(event: GestureResponderEvent): void {
|
||||
const view = viewRef.current;
|
||||
if (view != null) {
|
||||
Commands.setPressed(view, false);
|
||||
|
||||
@@ -15,7 +15,7 @@ import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
||||
import type {
|
||||
LayoutChangeEvent,
|
||||
PressEvent,
|
||||
GestureResponderEvent,
|
||||
ScrollEvent,
|
||||
} from '../../Types/CoreEventTypes';
|
||||
import type {EventSubscription} from '../../vendor/emitter/EventEmitter';
|
||||
@@ -1322,7 +1322,9 @@ class ScrollView extends React.Component<Props, State> {
|
||||
/**
|
||||
* Invoke this from an `onResponderGrant` event.
|
||||
*/
|
||||
_handleResponderGrant: (e: PressEvent) => void = (e: PressEvent) => {
|
||||
_handleResponderGrant: (e: GestureResponderEvent) => void = (
|
||||
e: GestureResponderEvent,
|
||||
) => {
|
||||
this._observedScrollSinceBecomingResponder = false;
|
||||
this.props.onResponderGrant && this.props.onResponderGrant(e);
|
||||
this._becameResponderWhileAnimating = this._isAnimating();
|
||||
@@ -1343,7 +1345,9 @@ class ScrollView extends React.Component<Props, State> {
|
||||
/**
|
||||
* Invoke this from an `onResponderRelease` event.
|
||||
*/
|
||||
_handleResponderRelease: (e: PressEvent) => void = (e: PressEvent) => {
|
||||
_handleResponderRelease: (e: GestureResponderEvent) => void = (
|
||||
e: GestureResponderEvent,
|
||||
) => {
|
||||
this._isTouching = e.nativeEvent.touches.length !== 0;
|
||||
this.props.onResponderRelease && this.props.onResponderRelease(e);
|
||||
|
||||
@@ -1428,8 +1432,8 @@ class ScrollView extends React.Component<Props, State> {
|
||||
* true.
|
||||
*
|
||||
*/
|
||||
_handleStartShouldSetResponder: (e: PressEvent) => boolean = (
|
||||
e: PressEvent,
|
||||
_handleStartShouldSetResponder: (e: GestureResponderEvent) => boolean = (
|
||||
e: GestureResponderEvent,
|
||||
) => {
|
||||
// Allow any event touch pass through if the default pan responder is disabled
|
||||
if (this.props.disableScrollViewPanResponder === true) {
|
||||
@@ -1458,55 +1462,54 @@ class ScrollView extends React.Component<Props, State> {
|
||||
*
|
||||
* Invoke this from an `onStartShouldSetResponderCapture` event.
|
||||
*/
|
||||
_handleStartShouldSetResponderCapture: (e: PressEvent) => boolean = (
|
||||
e: PressEvent,
|
||||
) => {
|
||||
// The scroll view should receive taps instead of its descendants if:
|
||||
// * it is already animating/decelerating
|
||||
if (this._isAnimating()) {
|
||||
return true;
|
||||
}
|
||||
_handleStartShouldSetResponderCapture: (e: GestureResponderEvent) => boolean =
|
||||
(e: GestureResponderEvent) => {
|
||||
// The scroll view should receive taps instead of its descendants if:
|
||||
// * it is already animating/decelerating
|
||||
if (this._isAnimating()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Allow any event touch pass through if the default pan responder is disabled
|
||||
if (this.props.disableScrollViewPanResponder === true) {
|
||||
return false;
|
||||
}
|
||||
// Allow any event touch pass through if the default pan responder is disabled
|
||||
if (this.props.disableScrollViewPanResponder === true) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// * the keyboard is up, keyboardShouldPersistTaps is 'never' (the default),
|
||||
// and a new touch starts with a non-textinput target (in which case the
|
||||
// first tap should be sent to the scroll view and dismiss the keyboard,
|
||||
// then the second tap goes to the actual interior view)
|
||||
const {keyboardShouldPersistTaps} = this.props;
|
||||
const keyboardNeverPersistTaps =
|
||||
!keyboardShouldPersistTaps || keyboardShouldPersistTaps === 'never';
|
||||
// * the keyboard is up, keyboardShouldPersistTaps is 'never' (the default),
|
||||
// and a new touch starts with a non-textinput target (in which case the
|
||||
// first tap should be sent to the scroll view and dismiss the keyboard,
|
||||
// then the second tap goes to the actual interior view)
|
||||
const {keyboardShouldPersistTaps} = this.props;
|
||||
const keyboardNeverPersistTaps =
|
||||
!keyboardShouldPersistTaps || keyboardShouldPersistTaps === 'never';
|
||||
|
||||
if (typeof e.target === 'number') {
|
||||
if (__DEV__) {
|
||||
console.error(
|
||||
'Did not expect event target to be a number. Should have been a native component',
|
||||
);
|
||||
if (typeof e.target === 'number') {
|
||||
if (__DEV__) {
|
||||
console.error(
|
||||
'Did not expect event target to be a number. Should have been a native component',
|
||||
);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Let presses through if the soft keyboard is detached from the viewport
|
||||
if (this._softKeyboardIsDetached()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
keyboardNeverPersistTaps &&
|
||||
this._keyboardIsDismissible() &&
|
||||
e.target != null &&
|
||||
// $FlowFixMe[incompatible-call]
|
||||
!TextInputState.isTextInput(e.target)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Let presses through if the soft keyboard is detached from the viewport
|
||||
if (this._softKeyboardIsDetached()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (
|
||||
keyboardNeverPersistTaps &&
|
||||
this._keyboardIsDismissible() &&
|
||||
e.target != null &&
|
||||
// $FlowFixMe[incompatible-call]
|
||||
!TextInputState.isTextInput(e.target)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Do we consider there to be a dismissible soft-keyboard open?
|
||||
@@ -1550,9 +1553,11 @@ class ScrollView extends React.Component<Props, State> {
|
||||
/**
|
||||
* Invoke this from an `onTouchEnd` event.
|
||||
*
|
||||
* @param {PressEvent} e Event.
|
||||
* @param {GestureResponderEvent} e Event.
|
||||
*/
|
||||
_handleTouchEnd: (e: PressEvent) => void = (e: PressEvent) => {
|
||||
_handleTouchEnd: (e: GestureResponderEvent) => void = (
|
||||
e: GestureResponderEvent,
|
||||
) => {
|
||||
const nativeEvent = e.nativeEvent;
|
||||
this._isTouching = nativeEvent.touches.length !== 0;
|
||||
|
||||
@@ -1580,9 +1585,11 @@ class ScrollView extends React.Component<Props, State> {
|
||||
/**
|
||||
* Invoke this from an `onTouchCancel` event.
|
||||
*
|
||||
* @param {PressEvent} e Event.
|
||||
* @param {GestureResponderEvent} e Event.
|
||||
*/
|
||||
_handleTouchCancel: (e: PressEvent) => void = (e: PressEvent) => {
|
||||
_handleTouchCancel: (e: GestureResponderEvent) => void = (
|
||||
e: GestureResponderEvent,
|
||||
) => {
|
||||
this._isTouching = false;
|
||||
this.props.onTouchCancel && this.props.onTouchCancel(e);
|
||||
};
|
||||
@@ -1596,9 +1603,11 @@ class ScrollView extends React.Component<Props, State> {
|
||||
* responder). The `onResponderReject` won't fire in that case - it only
|
||||
* fires when a *current* responder rejects our request.
|
||||
*
|
||||
* @param {PressEvent} e Touch Start event.
|
||||
* @param {GestureResponderEvent} e Touch Start event.
|
||||
*/
|
||||
_handleTouchStart: (e: PressEvent) => void = (e: PressEvent) => {
|
||||
_handleTouchStart: (e: GestureResponderEvent) => void = (
|
||||
e: GestureResponderEvent,
|
||||
) => {
|
||||
this._isTouching = true;
|
||||
this.props.onTouchStart && this.props.onTouchStart(e);
|
||||
};
|
||||
@@ -1612,9 +1621,11 @@ class ScrollView extends React.Component<Props, State> {
|
||||
* responder). The `onResponderReject` won't fire in that case - it only
|
||||
* fires when a *current* responder rejects our request.
|
||||
*
|
||||
* @param {PressEvent} e Touch Start event.
|
||||
* @param {GestureResponderEvent} e Touch Start event.
|
||||
*/
|
||||
_handleTouchMove: (e: PressEvent) => void = (e: PressEvent) => {
|
||||
_handleTouchMove: (e: GestureResponderEvent) => void = (
|
||||
e: GestureResponderEvent,
|
||||
) => {
|
||||
this.props.onTouchMove && this.props.onTouchMove(e);
|
||||
};
|
||||
|
||||
|
||||
+5
-2
@@ -13,7 +13,10 @@
|
||||
import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
|
||||
import type {PointProp} from '../../StyleSheet/PointPropType';
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
||||
import type {PressEvent, ScrollEvent} from '../../Types/CoreEventTypes';
|
||||
import type {
|
||||
GestureResponderEvent,
|
||||
ScrollEvent,
|
||||
} from '../../Types/CoreEventTypes';
|
||||
import type {ViewProps} from '../View/ViewPropTypes';
|
||||
|
||||
export type ScrollViewNativeProps = $ReadOnly<{
|
||||
@@ -76,6 +79,6 @@ export type ScrollViewNativeProps = $ReadOnly<{
|
||||
snapToStart?: ?boolean,
|
||||
zoomScale?: ?number,
|
||||
// Overrides
|
||||
onResponderGrant?: ?(e: PressEvent) => void | boolean,
|
||||
onResponderGrant?: ?(e: GestureResponderEvent) => void | boolean,
|
||||
...
|
||||
}>;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
||||
import type {SyntheticEvent} from '../../Types/CoreEventTypes';
|
||||
import type {NativeSyntheticEvent} from '../../Types/CoreEventTypes';
|
||||
import type {ViewProps} from '../View/ViewPropTypes';
|
||||
|
||||
import StyleSheet from '../../StyleSheet/StyleSheet';
|
||||
@@ -23,7 +23,7 @@ import SwitchNativeComponent, {
|
||||
} from './SwitchNativeComponent';
|
||||
import * as React from 'react';
|
||||
|
||||
type SwitchChangeEvent = SyntheticEvent<
|
||||
type SwitchChangeEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
value: boolean,
|
||||
target: number,
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
|
||||
import type {HostInstance} from '../../Renderer/shims/ReactNativeTypes';
|
||||
import type {
|
||||
PressEvent,
|
||||
GestureResponderEvent,
|
||||
ScrollEvent,
|
||||
SyntheticEvent,
|
||||
NativeSyntheticEvent,
|
||||
} from '../../Types/CoreEventTypes';
|
||||
import type {ViewProps} from '../View/ViewPropTypes';
|
||||
|
||||
@@ -31,9 +31,10 @@ export type TextInputChangeEventData = $ReadOnly<{
|
||||
text: string,
|
||||
}>;
|
||||
|
||||
export type TextInputChangeEvent = SyntheticEvent<TextInputChangeEventData>;
|
||||
export type TextInputChangeEvent =
|
||||
NativeSyntheticEvent<TextInputChangeEventData>;
|
||||
|
||||
export type TextInputEvent = SyntheticEvent<
|
||||
export type TextInputEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
eventCount: number,
|
||||
previousText: string,
|
||||
@@ -55,7 +56,7 @@ export type TextInputContentSizeChangeEventData = $ReadOnly<{
|
||||
}>;
|
||||
|
||||
export type TextInputContentSizeChangeEvent =
|
||||
SyntheticEvent<TextInputContentSizeChangeEventData>;
|
||||
NativeSyntheticEvent<TextInputContentSizeChangeEventData>;
|
||||
|
||||
export type TargetEvent = $ReadOnly<{
|
||||
target: number,
|
||||
@@ -63,8 +64,8 @@ export type TargetEvent = $ReadOnly<{
|
||||
|
||||
export type TextInputFocusEventData = TargetEvent;
|
||||
|
||||
export type TextInputBlurEvent = SyntheticEvent<TextInputFocusEventData>;
|
||||
export type TextInputFocusEvent = SyntheticEvent<TextInputFocusEventData>;
|
||||
export type TextInputBlurEvent = NativeSyntheticEvent<TextInputFocusEventData>;
|
||||
export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
|
||||
|
||||
type Selection = $ReadOnly<{
|
||||
start: number,
|
||||
@@ -77,7 +78,7 @@ export type TextInputSelectionChangeEventData = $ReadOnly<{
|
||||
}>;
|
||||
|
||||
export type TextInputSelectionChangeEvent =
|
||||
SyntheticEvent<TextInputSelectionChangeEventData>;
|
||||
NativeSyntheticEvent<TextInputSelectionChangeEventData>;
|
||||
|
||||
export type TextInputKeyPressEventData = $ReadOnly<{
|
||||
...TargetEvent,
|
||||
@@ -86,7 +87,8 @@ export type TextInputKeyPressEventData = $ReadOnly<{
|
||||
eventCount: number,
|
||||
}>;
|
||||
|
||||
export type TextInputKeyPressEvent = SyntheticEvent<TextInputKeyPressEventData>;
|
||||
export type TextInputKeyPressEvent =
|
||||
NativeSyntheticEvent<TextInputKeyPressEventData>;
|
||||
|
||||
export type TextInputEndEditingEventData = $ReadOnly<{
|
||||
...TargetEvent,
|
||||
@@ -95,7 +97,7 @@ export type TextInputEndEditingEventData = $ReadOnly<{
|
||||
}>;
|
||||
|
||||
export type TextInputEditingEvent =
|
||||
SyntheticEvent<TextInputEndEditingEventData>;
|
||||
NativeSyntheticEvent<TextInputEndEditingEventData>;
|
||||
|
||||
type DataDetectorTypesType =
|
||||
| 'phoneNumber'
|
||||
@@ -817,17 +819,17 @@ export type TextInputProps = $ReadOnly<{
|
||||
/**
|
||||
* Called when a single tap gesture is detected.
|
||||
*/
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Called when a touch is engaged.
|
||||
*/
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Called when a touch is released.
|
||||
*/
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Callback that is called when the text input selection is changed.
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
import type {HostInstance} from '../../Renderer/shims/ReactNativeTypes';
|
||||
import type {____TextStyle_Internal as TextStyleInternal} from '../../StyleSheet/StyleSheetTypes';
|
||||
import type {
|
||||
PressEvent,
|
||||
GestureResponderEvent,
|
||||
ScrollEvent,
|
||||
SyntheticEvent,
|
||||
NativeSyntheticEvent,
|
||||
} from '../../Types/CoreEventTypes';
|
||||
import type {ViewProps} from '../View/ViewPropTypes';
|
||||
import type {TextInputType} from './TextInput.flow';
|
||||
@@ -72,9 +72,10 @@ export type TextInputChangeEventData = $ReadOnly<{
|
||||
text: string,
|
||||
}>;
|
||||
|
||||
export type TextInputChangeEvent = SyntheticEvent<TextInputChangeEventData>;
|
||||
export type TextInputChangeEvent =
|
||||
NativeSyntheticEvent<TextInputChangeEventData>;
|
||||
|
||||
export type TextInputEvent = SyntheticEvent<
|
||||
export type TextInputEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
eventCount: number,
|
||||
previousText: string,
|
||||
@@ -96,7 +97,7 @@ export type TextInputContentSizeChangeEventData = $ReadOnly<{
|
||||
}>;
|
||||
|
||||
export type TextInputContentSizeChangeEvent =
|
||||
SyntheticEvent<TextInputContentSizeChangeEventData>;
|
||||
NativeSyntheticEvent<TextInputContentSizeChangeEventData>;
|
||||
|
||||
export type TargetEvent = $ReadOnly<{
|
||||
target: number,
|
||||
@@ -104,8 +105,8 @@ export type TargetEvent = $ReadOnly<{
|
||||
|
||||
export type TextInputFocusEventData = TargetEvent;
|
||||
|
||||
export type TextInputBlurEvent = SyntheticEvent<TextInputFocusEventData>;
|
||||
export type TextInputFocusEvent = SyntheticEvent<TextInputFocusEventData>;
|
||||
export type TextInputBlurEvent = NativeSyntheticEvent<TextInputFocusEventData>;
|
||||
export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
|
||||
|
||||
type Selection = $ReadOnly<{
|
||||
start: number,
|
||||
@@ -118,7 +119,7 @@ export type TextInputSelectionChangeEventData = $ReadOnly<{
|
||||
}>;
|
||||
|
||||
export type TextInputSelectionChangeEvent =
|
||||
SyntheticEvent<TextInputSelectionChangeEventData>;
|
||||
NativeSyntheticEvent<TextInputSelectionChangeEventData>;
|
||||
|
||||
type TextInputKeyPressEventData = $ReadOnly<{
|
||||
...TargetEvent,
|
||||
@@ -127,7 +128,8 @@ type TextInputKeyPressEventData = $ReadOnly<{
|
||||
eventCount?: ?number,
|
||||
}>;
|
||||
|
||||
export type TextInputKeyPressEvent = SyntheticEvent<TextInputKeyPressEventData>;
|
||||
export type TextInputKeyPressEvent =
|
||||
NativeSyntheticEvent<TextInputKeyPressEventData>;
|
||||
|
||||
export type TextInputEndEditingEventData = $ReadOnly<{
|
||||
...TargetEvent,
|
||||
@@ -136,7 +138,7 @@ export type TextInputEndEditingEventData = $ReadOnly<{
|
||||
}>;
|
||||
|
||||
export type TextInputEditingEvent =
|
||||
SyntheticEvent<TextInputEndEditingEventData>;
|
||||
NativeSyntheticEvent<TextInputEndEditingEventData>;
|
||||
|
||||
type DataDetectorTypesType =
|
||||
| 'phoneNumber'
|
||||
@@ -817,17 +819,17 @@ export type TextInputProps = $ReadOnly<{
|
||||
/**
|
||||
* Called when a single tap gesture is detected.
|
||||
*/
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Called when a touch is engaged.
|
||||
*/
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Called when a touch is released.
|
||||
*/
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Callback that is called when the text input selection is changed.
|
||||
@@ -1521,7 +1523,7 @@ function InternalTextInput(props: TextInputProps): React.Node {
|
||||
const config = React.useMemo(
|
||||
() => ({
|
||||
hitSlop,
|
||||
onPress: (event: PressEvent) => {
|
||||
onPress: (event: GestureResponderEvent) => {
|
||||
onPress?.(event);
|
||||
if (editable !== false) {
|
||||
if (inputRef.current != null) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheet';
|
||||
import type {PressEvent} from '../../Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../../Types/CoreEventTypes';
|
||||
|
||||
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
|
||||
import UIManager from '../../ReactNative/UIManager';
|
||||
@@ -21,7 +21,7 @@ import Position from './Position';
|
||||
import * as React from 'react';
|
||||
|
||||
const extractSingleTouch = (nativeEvent: {
|
||||
+changedTouches: $ReadOnlyArray<PressEvent['nativeEvent']>,
|
||||
+changedTouches: $ReadOnlyArray<GestureResponderEvent['nativeEvent']>,
|
||||
+force?: number,
|
||||
+identifier: number,
|
||||
+locationX: number,
|
||||
@@ -30,7 +30,7 @@ const extractSingleTouch = (nativeEvent: {
|
||||
+pageY: number,
|
||||
+target: ?number,
|
||||
+timestamp: number,
|
||||
+touches: $ReadOnlyArray<PressEvent['nativeEvent']>,
|
||||
+touches: $ReadOnlyArray<GestureResponderEvent['nativeEvent']>,
|
||||
}) => {
|
||||
const touches = nativeEvent.touches;
|
||||
const changedTouches = nativeEvent.changedTouches;
|
||||
@@ -398,7 +398,7 @@ const TouchableMixin = {
|
||||
touchableGetInitialState: function (): {
|
||||
touchable: {
|
||||
touchState: ?State,
|
||||
responderID: ?PressEvent['currentTarget'],
|
||||
responderID: ?GestureResponderEvent['currentTarget'],
|
||||
},
|
||||
} {
|
||||
return {
|
||||
@@ -434,12 +434,12 @@ const TouchableMixin = {
|
||||
|
||||
/**
|
||||
* Place as callback for a DOM element's `onResponderGrant` event.
|
||||
* @param {SyntheticEvent} e Synthetic event from event system.
|
||||
* @param {NativeSyntheticEvent} e Synthetic event from event system.
|
||||
*
|
||||
*/
|
||||
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
touchableHandleResponderGrant: function (e: PressEvent) {
|
||||
touchableHandleResponderGrant: function (e: GestureResponderEvent) {
|
||||
const dispatchID = e.currentTarget;
|
||||
// Since e is used in a callback invoked on another event loop
|
||||
// (as in setTimeout etc), we need to call e.persist() on the
|
||||
@@ -482,7 +482,7 @@ const TouchableMixin = {
|
||||
*/
|
||||
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
touchableHandleResponderRelease: function (e: PressEvent) {
|
||||
touchableHandleResponderRelease: function (e: GestureResponderEvent) {
|
||||
this.pressInLocation = null;
|
||||
this._receiveSignal(Signals.RESPONDER_RELEASE, e);
|
||||
},
|
||||
@@ -492,7 +492,7 @@ const TouchableMixin = {
|
||||
*/
|
||||
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
touchableHandleResponderTerminate: function (e: PressEvent) {
|
||||
touchableHandleResponderTerminate: function (e: GestureResponderEvent) {
|
||||
this.pressInLocation = null;
|
||||
this._receiveSignal(Signals.RESPONDER_TERMINATED, e);
|
||||
},
|
||||
@@ -502,7 +502,7 @@ const TouchableMixin = {
|
||||
*/
|
||||
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
touchableHandleResponderMove: function (e: PressEvent) {
|
||||
touchableHandleResponderMove: function (e: GestureResponderEvent) {
|
||||
// Measurement may not have returned yet.
|
||||
if (!this.state.touchable.positionOnActivate) {
|
||||
return;
|
||||
@@ -732,14 +732,14 @@ const TouchableMixin = {
|
||||
|
||||
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
_handleDelay: function (e: PressEvent) {
|
||||
_handleDelay: function (e: GestureResponderEvent) {
|
||||
this.touchableDelayTimeout = null;
|
||||
this._receiveSignal(Signals.DELAY, e);
|
||||
},
|
||||
|
||||
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
_handleLongDelay: function (e: PressEvent) {
|
||||
_handleLongDelay: function (e: GestureResponderEvent) {
|
||||
this.longPressDelayTimeout = null;
|
||||
const curState = this.state.touchable.touchState;
|
||||
if (
|
||||
@@ -760,7 +760,7 @@ const TouchableMixin = {
|
||||
*/
|
||||
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
_receiveSignal: function (signal: Signal, e: PressEvent) {
|
||||
_receiveSignal: function (signal: Signal, e: GestureResponderEvent) {
|
||||
const responderID = this.state.touchable.responderID;
|
||||
const curState = this.state.touchable.touchState;
|
||||
const nextState = Transitions[curState] && Transitions[curState][signal];
|
||||
@@ -815,7 +815,7 @@ const TouchableMixin = {
|
||||
|
||||
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
_savePressInLocation: function (e: PressEvent) {
|
||||
_savePressInLocation: function (e: GestureResponderEvent) {
|
||||
const touch = extractSingleTouch(e.nativeEvent);
|
||||
const pageX = touch && touch.pageX;
|
||||
const pageY = touch && touch.pageY;
|
||||
@@ -852,7 +852,7 @@ const TouchableMixin = {
|
||||
curState: State,
|
||||
nextState: State,
|
||||
signal: Signal,
|
||||
e: PressEvent,
|
||||
e: GestureResponderEvent,
|
||||
) {
|
||||
const curIsHighlight = this._isHighlight(curState);
|
||||
const newIsHighlight = this._isHighlight(nextState);
|
||||
@@ -911,14 +911,14 @@ const TouchableMixin = {
|
||||
|
||||
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
_startHighlight: function (e: PressEvent) {
|
||||
_startHighlight: function (e: GestureResponderEvent) {
|
||||
this._savePressInLocation(e);
|
||||
this.touchableHandleActivePressIn && this.touchableHandleActivePressIn(e);
|
||||
},
|
||||
|
||||
/* $FlowFixMe[missing-this-annot] The 'this' type annotation(s) required by
|
||||
* Flow's LTI update could not be added via codemod */
|
||||
_endHighlight: function (e: PressEvent) {
|
||||
_endHighlight: function (e: GestureResponderEvent) {
|
||||
if (this.touchableHandleActivePressOut) {
|
||||
if (
|
||||
this.touchableGetPressOutDelayMS &&
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {PressEvent} from '../../Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../../Types/CoreEventTypes';
|
||||
import typeof TouchableWithoutFeedback from './TouchableWithoutFeedback';
|
||||
|
||||
import View from '../../Components/View/View';
|
||||
@@ -220,7 +220,7 @@ class TouchableNativeFeedback extends React.Component<Props, State> {
|
||||
}
|
||||
}
|
||||
|
||||
_dispatchHotspotUpdate(event: PressEvent): void {
|
||||
_dispatchHotspotUpdate(event: GestureResponderEvent): void {
|
||||
if (Platform.OS === 'android') {
|
||||
const {locationX, locationY} = event.nativeEvent;
|
||||
const hostComponentRef = findHostInstance_DEPRECATED(this);
|
||||
|
||||
+5
-5
@@ -20,7 +20,7 @@ import type {
|
||||
BlurEvent,
|
||||
FocusEvent,
|
||||
LayoutChangeEvent,
|
||||
PressEvent,
|
||||
GestureResponderEvent,
|
||||
} from '../../Types/CoreEventTypes';
|
||||
|
||||
import View from '../../Components/View/View';
|
||||
@@ -74,10 +74,10 @@ type Props = $ReadOnly<{
|
||||
onBlur?: ?(event: BlurEvent) => mixed,
|
||||
onFocus?: ?(event: FocusEvent) => mixed,
|
||||
onLayout?: ?(event: LayoutChangeEvent) => mixed,
|
||||
onLongPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onLongPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
pressRetentionOffset?: ?EdgeInsetsOrSizeProp,
|
||||
rejectResponderTermination?: ?boolean,
|
||||
testID?: ?string,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {SyntheticEvent} from '../../Types/CoreEventTypes';
|
||||
import type {NativeSyntheticEvent} from '../../Types/CoreEventTypes';
|
||||
|
||||
// This must be kept in sync with the AccessibilityRolesMask in RCTViewManager.m
|
||||
export type AccessibilityRole =
|
||||
@@ -160,7 +160,7 @@ export type AccessibilityActionInfo = $ReadOnly<{
|
||||
}>;
|
||||
|
||||
// The info included in the event sent to onAccessibilityAction
|
||||
export type AccessibilityActionEvent = SyntheticEvent<
|
||||
export type AccessibilityActionEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{actionName: string, ...}>,
|
||||
>;
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import type {
|
||||
LayoutRectangle,
|
||||
MouseEvent,
|
||||
PointerEvent,
|
||||
PressEvent,
|
||||
GestureResponderEvent,
|
||||
} from '../../Types/CoreEventTypes';
|
||||
import type {
|
||||
AccessibilityActionEvent,
|
||||
@@ -115,14 +115,14 @@ type FocusEventProps = $ReadOnly<{
|
||||
}>;
|
||||
|
||||
type TouchEventProps = $ReadOnly<{
|
||||
onTouchCancel?: ?(e: PressEvent) => void,
|
||||
onTouchCancelCapture?: ?(e: PressEvent) => void,
|
||||
onTouchEnd?: ?(e: PressEvent) => void,
|
||||
onTouchEndCapture?: ?(e: PressEvent) => void,
|
||||
onTouchMove?: ?(e: PressEvent) => void,
|
||||
onTouchMoveCapture?: ?(e: PressEvent) => void,
|
||||
onTouchStart?: ?(e: PressEvent) => void,
|
||||
onTouchStartCapture?: ?(e: PressEvent) => void,
|
||||
onTouchCancel?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchCancelCapture?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchEnd?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchEndCapture?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchMove?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchMoveCapture?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchStart?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchStartCapture?: ?(e: GestureResponderEvent) => void,
|
||||
}>;
|
||||
|
||||
/**
|
||||
@@ -140,7 +140,7 @@ export type GestureResponderHandlers = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/view#onmoveshouldsetresponder
|
||||
*/
|
||||
onMoveShouldSetResponder?: ?(e: PressEvent) => boolean,
|
||||
onMoveShouldSetResponder?: ?(e: GestureResponderEvent) => boolean,
|
||||
|
||||
/**
|
||||
* If a parent `View` wants to prevent a child `View` from becoming responder
|
||||
@@ -151,7 +151,7 @@ export type GestureResponderHandlers = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/view#onMoveShouldsetrespondercapture
|
||||
*/
|
||||
onMoveShouldSetResponderCapture?: ?(e: PressEvent) => boolean,
|
||||
onMoveShouldSetResponderCapture?: ?(e: GestureResponderEvent) => boolean,
|
||||
|
||||
/**
|
||||
* The View is now responding for touch events. This is the time to highlight
|
||||
@@ -165,7 +165,7 @@ export type GestureResponderHandlers = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/view#onrespondergrant
|
||||
*/
|
||||
onResponderGrant?: ?(e: PressEvent) => void | boolean,
|
||||
onResponderGrant?: ?(e: GestureResponderEvent) => void | boolean,
|
||||
|
||||
/**
|
||||
* The user is moving their finger.
|
||||
@@ -175,7 +175,7 @@ export type GestureResponderHandlers = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/view#onrespondermove
|
||||
*/
|
||||
onResponderMove?: ?(e: PressEvent) => void,
|
||||
onResponderMove?: ?(e: GestureResponderEvent) => void,
|
||||
|
||||
/**
|
||||
* Another responder is already active and will not release it to that `View`
|
||||
@@ -186,7 +186,7 @@ export type GestureResponderHandlers = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/view#onresponderreject
|
||||
*/
|
||||
onResponderReject?: ?(e: PressEvent) => void,
|
||||
onResponderReject?: ?(e: GestureResponderEvent) => void,
|
||||
|
||||
/**
|
||||
* Fired at the end of the touch.
|
||||
@@ -196,10 +196,10 @@ export type GestureResponderHandlers = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/view#onresponderrelease
|
||||
*/
|
||||
onResponderRelease?: ?(e: PressEvent) => void,
|
||||
onResponderRelease?: ?(e: GestureResponderEvent) => void,
|
||||
|
||||
onResponderStart?: ?(e: PressEvent) => void,
|
||||
onResponderEnd?: ?(e: PressEvent) => void,
|
||||
onResponderStart?: ?(e: GestureResponderEvent) => void,
|
||||
onResponderEnd?: ?(e: GestureResponderEvent) => void,
|
||||
|
||||
/**
|
||||
* The responder has been taken from the `View`. Might be taken by other
|
||||
@@ -212,7 +212,7 @@ export type GestureResponderHandlers = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/view#onresponderterminate
|
||||
*/
|
||||
onResponderTerminate?: ?(e: PressEvent) => void,
|
||||
onResponderTerminate?: ?(e: GestureResponderEvent) => void,
|
||||
|
||||
/**
|
||||
* Some other `View` wants to become responder and is asking this `View` to
|
||||
@@ -223,7 +223,7 @@ export type GestureResponderHandlers = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/view#onresponderterminationrequest
|
||||
*/
|
||||
onResponderTerminationRequest?: ?(e: PressEvent) => boolean,
|
||||
onResponderTerminationRequest?: ?(e: GestureResponderEvent) => boolean,
|
||||
|
||||
/**
|
||||
* Does this view want to become responder on the start of a touch?
|
||||
@@ -233,7 +233,7 @@ export type GestureResponderHandlers = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/view#onstartshouldsetresponder
|
||||
*/
|
||||
onStartShouldSetResponder?: ?(e: PressEvent) => boolean,
|
||||
onStartShouldSetResponder?: ?(e: GestureResponderEvent) => boolean,
|
||||
|
||||
/**
|
||||
* If a parent `View` wants to prevent a child `View` from becoming responder
|
||||
@@ -244,7 +244,7 @@ export type GestureResponderHandlers = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/view#onstartshouldsetrespondercapture
|
||||
*/
|
||||
onStartShouldSetResponderCapture?: ?(e: PressEvent) => boolean,
|
||||
onStartShouldSetResponderCapture?: ?(e: GestureResponderEvent) => boolean,
|
||||
}>;
|
||||
|
||||
type AndroidDrawableThemeAttr = $ReadOnly<{
|
||||
@@ -342,7 +342,7 @@ export type ViewPropsAndroid = $ReadOnly<{
|
||||
*
|
||||
* @platform android
|
||||
*/
|
||||
onClick?: ?(event: PressEvent) => mixed,
|
||||
onClick?: ?(event: GestureResponderEvent) => mixed,
|
||||
}>;
|
||||
|
||||
export type ViewPropsIOS = $ReadOnly<{
|
||||
|
||||
+1
-1
@@ -25,7 +25,7 @@ class CustomEvent extends EventPolyfill {
|
||||
const {bubbles, cancelable, composed} = options;
|
||||
super(typeArg, {bubbles, cancelable, composed});
|
||||
|
||||
this.detail = options.detail; // this would correspond to `NativeEvent` in SyntheticEvent
|
||||
this.detail = options.detail; // this would correspond to `NativeEvent` in NativeSyntheticEvent
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -152,9 +152,9 @@ class EventPolyfill implements IEvent {
|
||||
/** @deprecated */
|
||||
srcElement: Element; // TODO: nullable
|
||||
|
||||
// React Native-specific: proxy data to a SyntheticEvent when
|
||||
// React Native-specific: proxy data to a NativeSyntheticEvent when
|
||||
// certain methods are called.
|
||||
// SyntheticEvent will also have a reference to this instance -
|
||||
// NativeSyntheticEvent will also have a reference to this instance -
|
||||
// it is circular - and both classes use this reference to keep
|
||||
// data with the other in sync.
|
||||
_syntheticEvent: mixed;
|
||||
|
||||
+7
-4
@@ -17,13 +17,16 @@ import type {
|
||||
ImageStyleProp,
|
||||
ViewStyleProp,
|
||||
} from '../StyleSheet/StyleSheet';
|
||||
import type {LayoutChangeEvent, SyntheticEvent} from '../Types/CoreEventTypes';
|
||||
import type {
|
||||
LayoutChangeEvent,
|
||||
NativeSyntheticEvent,
|
||||
} from '../Types/CoreEventTypes';
|
||||
import typeof Image from './Image';
|
||||
import type {ImageResizeMode} from './ImageResizeMode';
|
||||
import type {ImageSource} from './ImageSource';
|
||||
import type {ElementRef, Node, RefSetter} from 'react';
|
||||
|
||||
export type ImageLoadEvent = SyntheticEvent<
|
||||
export type ImageLoadEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
source: $ReadOnly<{
|
||||
width: number,
|
||||
@@ -52,7 +55,7 @@ type IOSImageProps = $ReadOnly<{
|
||||
* See https://reactnative.dev/docs/image#onprogress
|
||||
*/
|
||||
onProgress?: ?(
|
||||
event: SyntheticEvent<$ReadOnly<{loaded: number, total: number}>>,
|
||||
event: NativeSyntheticEvent<$ReadOnly<{loaded: number, total: number}>>,
|
||||
) => void,
|
||||
}>;
|
||||
|
||||
@@ -163,7 +166,7 @@ export type ImageProps = $ReadOnly<{
|
||||
* See https://reactnative.dev/docs/image#onerror
|
||||
*/
|
||||
onError?: ?(
|
||||
event: SyntheticEvent<
|
||||
event: NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
error: string,
|
||||
}>,
|
||||
|
||||
+32
-29
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PressEvent} from '../Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../Types/CoreEventTypes';
|
||||
|
||||
const InteractionManager = require('./InteractionManager').default;
|
||||
const TouchHistoryMath = require('./TouchHistoryMath').default;
|
||||
@@ -184,25 +184,28 @@ export type GestureState = {
|
||||
};
|
||||
|
||||
type ActiveCallback = (
|
||||
event: PressEvent,
|
||||
event: GestureResponderEvent,
|
||||
gestureState: GestureState,
|
||||
) => boolean;
|
||||
|
||||
type PassiveCallback = (event: PressEvent, gestureState: GestureState) => mixed;
|
||||
type PassiveCallback = (
|
||||
event: GestureResponderEvent,
|
||||
gestureState: GestureState,
|
||||
) => mixed;
|
||||
|
||||
export type PanHandlers = {
|
||||
onMoveShouldSetResponder: (event: PressEvent) => boolean,
|
||||
onMoveShouldSetResponderCapture: (event: PressEvent) => boolean,
|
||||
onResponderEnd: (event: PressEvent) => void,
|
||||
onResponderGrant: (event: PressEvent) => boolean,
|
||||
onResponderMove: (event: PressEvent) => void,
|
||||
onResponderReject: (event: PressEvent) => void,
|
||||
onResponderRelease: (event: PressEvent) => void,
|
||||
onResponderStart: (event: PressEvent) => void,
|
||||
onResponderTerminate: (event: PressEvent) => void,
|
||||
onResponderTerminationRequest: (event: PressEvent) => boolean,
|
||||
onStartShouldSetResponder: (event: PressEvent) => boolean,
|
||||
onStartShouldSetResponderCapture: (event: PressEvent) => boolean,
|
||||
onMoveShouldSetResponder: (event: GestureResponderEvent) => boolean,
|
||||
onMoveShouldSetResponderCapture: (event: GestureResponderEvent) => boolean,
|
||||
onResponderEnd: (event: GestureResponderEvent) => void,
|
||||
onResponderGrant: (event: GestureResponderEvent) => boolean,
|
||||
onResponderMove: (event: GestureResponderEvent) => void,
|
||||
onResponderReject: (event: GestureResponderEvent) => void,
|
||||
onResponderRelease: (event: GestureResponderEvent) => void,
|
||||
onResponderStart: (event: GestureResponderEvent) => void,
|
||||
onResponderTerminate: (event: GestureResponderEvent) => void,
|
||||
onResponderTerminationRequest: (event: GestureResponderEvent) => boolean,
|
||||
onStartShouldSetResponder: (event: GestureResponderEvent) => boolean,
|
||||
onStartShouldSetResponderCapture: (event: GestureResponderEvent) => boolean,
|
||||
};
|
||||
|
||||
type PanResponderConfig = $ReadOnly<{
|
||||
@@ -330,7 +333,7 @@ const PanResponder = {
|
||||
*/
|
||||
_updateGestureStateOnMove(
|
||||
gestureState: GestureState,
|
||||
touchHistory: $PropertyType<PressEvent, 'touchHistory'>,
|
||||
touchHistory: $PropertyType<GestureResponderEvent, 'touchHistory'>,
|
||||
) {
|
||||
gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
|
||||
gestureState.moveX = currentCentroidXOfTouchesChangedAfter(
|
||||
@@ -420,17 +423,17 @@ const PanResponder = {
|
||||
_accountsForMovesUpTo: 0,
|
||||
};
|
||||
const panHandlers = {
|
||||
onStartShouldSetResponder(event: PressEvent): boolean {
|
||||
onStartShouldSetResponder(event: GestureResponderEvent): boolean {
|
||||
return config.onStartShouldSetPanResponder == null
|
||||
? false
|
||||
: config.onStartShouldSetPanResponder(event, gestureState);
|
||||
},
|
||||
onMoveShouldSetResponder(event: PressEvent): boolean {
|
||||
onMoveShouldSetResponder(event: GestureResponderEvent): boolean {
|
||||
return config.onMoveShouldSetPanResponder == null
|
||||
? false
|
||||
: config.onMoveShouldSetPanResponder(event, gestureState);
|
||||
},
|
||||
onStartShouldSetResponderCapture(event: PressEvent): boolean {
|
||||
onStartShouldSetResponderCapture(event: GestureResponderEvent): boolean {
|
||||
// TODO: Actually, we should reinitialize the state any time
|
||||
// touches.length increases from 0 active to > 0 active.
|
||||
if (event.nativeEvent.touches.length === 1) {
|
||||
@@ -443,7 +446,7 @@ const PanResponder = {
|
||||
: false;
|
||||
},
|
||||
|
||||
onMoveShouldSetResponderCapture(event: PressEvent): boolean {
|
||||
onMoveShouldSetResponderCapture(event: GestureResponderEvent): boolean {
|
||||
const touchHistory = event.touchHistory;
|
||||
// Responder system incorrectly dispatches should* to current responder
|
||||
// Filter out any touch moves past the first one - we would have
|
||||
@@ -460,7 +463,7 @@ const PanResponder = {
|
||||
: false;
|
||||
},
|
||||
|
||||
onResponderGrant(event: PressEvent): boolean {
|
||||
onResponderGrant(event: GestureResponderEvent): boolean {
|
||||
if (!interactionState.handle) {
|
||||
interactionState.handle =
|
||||
InteractionManager.createInteractionHandle();
|
||||
@@ -478,7 +481,7 @@ const PanResponder = {
|
||||
: config.onShouldBlockNativeResponder(event, gestureState);
|
||||
},
|
||||
|
||||
onResponderReject(event: PressEvent): void {
|
||||
onResponderReject(event: GestureResponderEvent): void {
|
||||
clearInteractionHandle(
|
||||
interactionState,
|
||||
config.onPanResponderReject,
|
||||
@@ -487,7 +490,7 @@ const PanResponder = {
|
||||
);
|
||||
},
|
||||
|
||||
onResponderRelease(event: PressEvent): void {
|
||||
onResponderRelease(event: GestureResponderEvent): void {
|
||||
clearInteractionHandle(
|
||||
interactionState,
|
||||
config.onPanResponderRelease,
|
||||
@@ -497,7 +500,7 @@ const PanResponder = {
|
||||
PanResponder._initializeGestureState(gestureState);
|
||||
},
|
||||
|
||||
onResponderStart(event: PressEvent): void {
|
||||
onResponderStart(event: GestureResponderEvent): void {
|
||||
const touchHistory = event.touchHistory;
|
||||
gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
|
||||
if (config.onPanResponderStart) {
|
||||
@@ -505,7 +508,7 @@ const PanResponder = {
|
||||
}
|
||||
},
|
||||
|
||||
onResponderMove(event: PressEvent): void {
|
||||
onResponderMove(event: GestureResponderEvent): void {
|
||||
const touchHistory = event.touchHistory;
|
||||
// Guard against the dispatch of two touch moves when there are two
|
||||
// simultaneously changed touches.
|
||||
@@ -523,7 +526,7 @@ const PanResponder = {
|
||||
}
|
||||
},
|
||||
|
||||
onResponderEnd(event: PressEvent): void {
|
||||
onResponderEnd(event: GestureResponderEvent): void {
|
||||
const touchHistory = event.touchHistory;
|
||||
gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
|
||||
clearInteractionHandle(
|
||||
@@ -534,7 +537,7 @@ const PanResponder = {
|
||||
);
|
||||
},
|
||||
|
||||
onResponderTerminate(event: PressEvent): void {
|
||||
onResponderTerminate(event: GestureResponderEvent): void {
|
||||
clearInteractionHandle(
|
||||
interactionState,
|
||||
config.onPanResponderTerminate,
|
||||
@@ -544,7 +547,7 @@ const PanResponder = {
|
||||
PanResponder._initializeGestureState(gestureState);
|
||||
},
|
||||
|
||||
onResponderTerminationRequest(event: PressEvent): boolean {
|
||||
onResponderTerminationRequest(event: GestureResponderEvent): boolean {
|
||||
return config.onPanResponderTerminationRequest == null
|
||||
? true
|
||||
: config.onPanResponderTerminationRequest(event, gestureState);
|
||||
@@ -562,7 +565,7 @@ const PanResponder = {
|
||||
function clearInteractionHandle(
|
||||
interactionState: {handle: ?number, ...},
|
||||
callback: ?(ActiveCallback | PassiveCallback),
|
||||
event: PressEvent,
|
||||
event: GestureResponderEvent,
|
||||
gestureState: GestureState,
|
||||
) {
|
||||
if (interactionState.handle) {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import type {EdgeInsetsProp} from '../../StyleSheet/EdgeInsetsPropType';
|
||||
import type {ViewStyleProp} from '../../StyleSheet/StyleSheet';
|
||||
import type {PressEvent} from '../../Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../../Types/CoreEventTypes';
|
||||
|
||||
import TouchableWithoutFeedback from '../../Components/Touchable/TouchableWithoutFeedback';
|
||||
import View from '../../Components/View/View';
|
||||
@@ -26,7 +26,7 @@ type Props = $ReadOnly<{
|
||||
}>,
|
||||
children?: React.Node,
|
||||
hitSlop?: ?EdgeInsetsProp,
|
||||
onPress?: ?(event: PressEvent) => void,
|
||||
onPress?: ?(event: GestureResponderEvent) => void,
|
||||
style?: ViewStyleProp,
|
||||
}>;
|
||||
|
||||
|
||||
+2
-2
@@ -8,7 +8,7 @@
|
||||
* @format
|
||||
*/
|
||||
|
||||
import type {PressEvent} from '../../Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../../Types/CoreEventTypes';
|
||||
|
||||
import Animated from '../../Animated/Animated';
|
||||
import Easing from '../../Animated/Easing';
|
||||
@@ -19,7 +19,7 @@ import * as LogBoxStyle from './LogBoxStyle';
|
||||
import * as React from 'react';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
onPress?: ?(event: PressEvent) => void,
|
||||
onPress?: ?(event: GestureResponderEvent) => void,
|
||||
status: 'COMPLETE' | 'FAILED' | 'NONE' | 'PENDING',
|
||||
}>;
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
*/
|
||||
|
||||
import type {StackFrame} from '../../Core/NativeExceptionsManager';
|
||||
import type {PressEvent} from '../../Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../../Types/CoreEventTypes';
|
||||
|
||||
import View from '../../Components/View/View';
|
||||
import StyleSheet from '../../StyleSheet/StyleSheet';
|
||||
@@ -21,7 +21,7 @@ import * as React from 'react';
|
||||
|
||||
type Props = $ReadOnly<{
|
||||
frame: StackFrame,
|
||||
onPress?: ?(event: PressEvent) => void,
|
||||
onPress?: ?(event: GestureResponderEvent) => void,
|
||||
}>;
|
||||
|
||||
function LogBoxInspectorStackFrame(props: Props): React.Node {
|
||||
|
||||
+23
-23
@@ -13,7 +13,7 @@ import type {
|
||||
BlurEvent,
|
||||
FocusEvent,
|
||||
MouseEvent,
|
||||
PressEvent,
|
||||
GestureResponderEvent,
|
||||
} from '../Types/CoreEventTypes';
|
||||
|
||||
import SoundManager from '../Components/Sound/SoundManager';
|
||||
@@ -108,27 +108,27 @@ export type PressabilityConfig = $ReadOnly<{
|
||||
/**
|
||||
* Called when a long press gesture has been triggered.
|
||||
*/
|
||||
onLongPress?: ?(event: PressEvent) => mixed,
|
||||
onLongPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Called when a press gesture has been triggered.
|
||||
*/
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Called when the press is activated to provide visual feedback.
|
||||
*/
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Called when the press location moves. (This should rarely be used.)
|
||||
*/
|
||||
onPressMove?: ?(event: PressEvent) => mixed,
|
||||
onPressMove?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Called when the press is deactivated to undo visual feedback.
|
||||
*/
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* Whether to prevent any other native components from becoming responder
|
||||
@@ -139,16 +139,16 @@ export type PressabilityConfig = $ReadOnly<{
|
||||
|
||||
export type EventHandlers = $ReadOnly<{
|
||||
onBlur: (event: BlurEvent) => void,
|
||||
onClick: (event: PressEvent) => void,
|
||||
onClick: (event: GestureResponderEvent) => void,
|
||||
onFocus: (event: FocusEvent) => void,
|
||||
onMouseEnter?: (event: MouseEvent) => void,
|
||||
onMouseLeave?: (event: MouseEvent) => void,
|
||||
onPointerEnter?: (event: PointerEvent) => void,
|
||||
onPointerLeave?: (event: PointerEvent) => void,
|
||||
onResponderGrant: (event: PressEvent) => void | boolean,
|
||||
onResponderMove: (event: PressEvent) => void,
|
||||
onResponderRelease: (event: PressEvent) => void,
|
||||
onResponderTerminate: (event: PressEvent) => void,
|
||||
onResponderGrant: (event: GestureResponderEvent) => void | boolean,
|
||||
onResponderMove: (event: GestureResponderEvent) => void,
|
||||
onResponderRelease: (event: GestureResponderEvent) => void,
|
||||
onResponderTerminate: (event: GestureResponderEvent) => void,
|
||||
onResponderTerminationRequest: () => boolean,
|
||||
onStartShouldSetResponder: () => boolean,
|
||||
}>;
|
||||
@@ -450,7 +450,7 @@ export default class Pressability {
|
||||
return !disabled ?? true;
|
||||
},
|
||||
|
||||
onResponderGrant: (event: PressEvent): void | boolean => {
|
||||
onResponderGrant: (event: GestureResponderEvent): void | boolean => {
|
||||
event.persist();
|
||||
|
||||
this._cancelPressOutDelayTimeout();
|
||||
@@ -480,7 +480,7 @@ export default class Pressability {
|
||||
return this._config.blockNativeResponder === true;
|
||||
},
|
||||
|
||||
onResponderMove: (event: PressEvent): void => {
|
||||
onResponderMove: (event: GestureResponderEvent): void => {
|
||||
const {onPressMove} = this._config;
|
||||
if (onPressMove != null) {
|
||||
onPressMove(event);
|
||||
@@ -515,11 +515,11 @@ export default class Pressability {
|
||||
}
|
||||
},
|
||||
|
||||
onResponderRelease: (event: PressEvent): void => {
|
||||
onResponderRelease: (event: GestureResponderEvent): void => {
|
||||
this._receiveSignal('RESPONDER_RELEASE', event);
|
||||
},
|
||||
|
||||
onResponderTerminate: (event: PressEvent): void => {
|
||||
onResponderTerminate: (event: GestureResponderEvent): void => {
|
||||
this._receiveSignal('RESPONDER_TERMINATED', event);
|
||||
},
|
||||
|
||||
@@ -528,7 +528,7 @@ export default class Pressability {
|
||||
return cancelable ?? true;
|
||||
},
|
||||
|
||||
onClick: (event: PressEvent): void => {
|
||||
onClick: (event: GestureResponderEvent): void => {
|
||||
// If event has `pointerType`, it was emitted from a PointerEvent and
|
||||
// we should ignore it to avoid triggering `onPress` twice.
|
||||
if (event?.nativeEvent?.hasOwnProperty?.('pointerType')) {
|
||||
@@ -664,7 +664,7 @@ export default class Pressability {
|
||||
* Receives a state machine signal, performs side effects of the transition
|
||||
* and stores the new state. Validates the transition as well.
|
||||
*/
|
||||
_receiveSignal(signal: TouchSignal, event: PressEvent): void {
|
||||
_receiveSignal(signal: TouchSignal, event: GestureResponderEvent): void {
|
||||
// Especially on iOS, not all events have timestamps associated.
|
||||
// For telemetry purposes, this doesn't matter too much, as long as *some* do.
|
||||
// Since the native timestamp is integral for logging telemetry, just skip
|
||||
@@ -706,7 +706,7 @@ export default class Pressability {
|
||||
prevState: TouchState,
|
||||
nextState: TouchState,
|
||||
signal: TouchSignal,
|
||||
event: PressEvent,
|
||||
event: GestureResponderEvent,
|
||||
): void {
|
||||
if (isTerminalSignal(signal)) {
|
||||
this._touchActivatePosition = null;
|
||||
@@ -762,7 +762,7 @@ export default class Pressability {
|
||||
this._cancelPressDelayTimeout();
|
||||
}
|
||||
|
||||
_activate(event: PressEvent): void {
|
||||
_activate(event: GestureResponderEvent): void {
|
||||
const {onPressIn} = this._config;
|
||||
const {pageX, pageY} = getTouchFromPressEvent(event);
|
||||
this._touchActivatePosition = {pageX, pageY};
|
||||
@@ -772,7 +772,7 @@ export default class Pressability {
|
||||
}
|
||||
}
|
||||
|
||||
_deactivate(event: PressEvent): void {
|
||||
_deactivate(event: GestureResponderEvent): void {
|
||||
const {onPressOut} = this._config;
|
||||
if (onPressOut != null) {
|
||||
const minPressDuration = normalizeDelay(
|
||||
@@ -829,7 +829,7 @@ export default class Pressability {
|
||||
};
|
||||
|
||||
_isTouchWithinResponderRegion(
|
||||
touch: $PropertyType<PressEvent, 'nativeEvent'>,
|
||||
touch: $PropertyType<GestureResponderEvent, 'nativeEvent'>,
|
||||
responderRegion: $ReadOnly<{
|
||||
bottom: number,
|
||||
left: number,
|
||||
@@ -874,7 +874,7 @@ export default class Pressability {
|
||||
);
|
||||
}
|
||||
|
||||
_handleLongPress(event: PressEvent): void {
|
||||
_handleLongPress(event: GestureResponderEvent): void {
|
||||
if (
|
||||
this._touchState === 'RESPONDER_ACTIVE_PRESS_IN' ||
|
||||
this._touchState === 'RESPONDER_ACTIVE_LONG_PRESS_IN'
|
||||
@@ -927,7 +927,7 @@ function normalizeDelay(
|
||||
return Math.max(min, delay ?? fallback);
|
||||
}
|
||||
|
||||
const getTouchFromPressEvent = (event: PressEvent) => {
|
||||
const getTouchFromPressEvent = (event: GestureResponderEvent) => {
|
||||
const {changedTouches, touches} = event.nativeEvent;
|
||||
|
||||
if (touches != null && touches.length > 0) {
|
||||
|
||||
+4
-4
@@ -12,7 +12,7 @@
|
||||
// TODO(legacy-fake-timers): Fix these tests to work with modern timers.
|
||||
jest.useFakeTimers({legacyFakeTimers: true});
|
||||
|
||||
import type {PressEvent} from '../../Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../../Types/CoreEventTypes';
|
||||
import type {PressabilityConfig} from '../Pressability';
|
||||
|
||||
const UIManager = require('../../ReactNative/UIManager').default;
|
||||
@@ -176,7 +176,7 @@ const createMockPressEvent = (
|
||||
pageX: number,
|
||||
pageY: number,
|
||||
}>,
|
||||
): PressEvent => {
|
||||
): GestureResponderEvent => {
|
||||
let registrationName = '';
|
||||
let pageX = 0;
|
||||
let pageY = 0;
|
||||
@@ -190,7 +190,7 @@ const createMockPressEvent = (
|
||||
}
|
||||
|
||||
const nativeEvent = {
|
||||
changedTouches: ([]: Array<PressEvent['nativeEvent']>),
|
||||
changedTouches: ([]: Array<GestureResponderEvent['nativeEvent']>),
|
||||
force: 1,
|
||||
identifier: 42,
|
||||
locationX: pageX,
|
||||
@@ -199,7 +199,7 @@ const createMockPressEvent = (
|
||||
pageY,
|
||||
target: 42,
|
||||
timestamp: 1075881600000,
|
||||
touches: ([]: Array<PressEvent['nativeEvent']>),
|
||||
touches: ([]: Array<GestureResponderEvent['nativeEvent']>),
|
||||
};
|
||||
|
||||
nativeEvent.changedTouches.push(nativeEvent);
|
||||
|
||||
+15
-15
@@ -10,7 +10,7 @@
|
||||
|
||||
import type {TextStyleProp} from '../StyleSheet/StyleSheet';
|
||||
import type {____TextStyle_Internal as TextStyleInternal} from '../StyleSheet/StyleSheetTypes';
|
||||
import type {PressEvent} from '../Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../Types/CoreEventTypes';
|
||||
import type {NativeTextProps} from './TextNativeComponent';
|
||||
import type {PressRetentionOffset, TextProps} from './TextProps';
|
||||
|
||||
@@ -331,14 +331,14 @@ const Text: component(
|
||||
Text.displayName = 'Text';
|
||||
|
||||
type TextPressabilityProps = $ReadOnly<{
|
||||
onLongPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onResponderGrant?: ?(event: PressEvent) => void,
|
||||
onResponderMove?: ?(event: PressEvent) => void,
|
||||
onResponderRelease?: ?(event: PressEvent) => void,
|
||||
onResponderTerminate?: ?(event: PressEvent) => void,
|
||||
onLongPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
onResponderGrant?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderMove?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderRelease?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderTerminate?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderTerminationRequest?: ?() => boolean,
|
||||
onStartShouldSetResponder?: ?() => boolean,
|
||||
pressRetentionOffset?: ?PressRetentionOffset,
|
||||
@@ -375,12 +375,12 @@ function useTextPressability({
|
||||
// in the best case, and cause issues with text selection in the worst case. Forcing
|
||||
// the isHighlighted prop to false on all platforms except iOS.
|
||||
if (Platform.OS === 'ios') {
|
||||
_onPressIn = (event: PressEvent) => {
|
||||
_onPressIn = (event: GestureResponderEvent) => {
|
||||
setHighlighted(suppressHighlighting == null || !suppressHighlighting);
|
||||
onPressIn?.(event);
|
||||
};
|
||||
|
||||
_onPressOut = (event: PressEvent) => {
|
||||
_onPressOut = (event: GestureResponderEvent) => {
|
||||
setHighlighted(false);
|
||||
onPressOut?.(event);
|
||||
};
|
||||
@@ -412,25 +412,25 @@ function useTextPressability({
|
||||
eventHandlers == null
|
||||
? null
|
||||
: {
|
||||
onResponderGrant(event: PressEvent) {
|
||||
onResponderGrant(event: GestureResponderEvent) {
|
||||
eventHandlers.onResponderGrant(event);
|
||||
if (onResponderGrant != null) {
|
||||
onResponderGrant(event);
|
||||
}
|
||||
},
|
||||
onResponderMove(event: PressEvent) {
|
||||
onResponderMove(event: GestureResponderEvent) {
|
||||
eventHandlers.onResponderMove(event);
|
||||
if (onResponderMove != null) {
|
||||
onResponderMove(event);
|
||||
}
|
||||
},
|
||||
onResponderRelease(event: PressEvent) {
|
||||
onResponderRelease(event: GestureResponderEvent) {
|
||||
eventHandlers.onResponderRelease(event);
|
||||
if (onResponderRelease != null) {
|
||||
onResponderRelease(event);
|
||||
}
|
||||
},
|
||||
onResponderTerminate(event: PressEvent) {
|
||||
onResponderTerminate(event: GestureResponderEvent) {
|
||||
eventHandlers.onResponderTerminate(event);
|
||||
if (onResponderTerminate != null) {
|
||||
onResponderTerminate(event);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
|
||||
import type {ProcessedColorValue} from '../StyleSheet/processColor';
|
||||
import type {PressEvent} from '../Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../Types/CoreEventTypes';
|
||||
import type {TextProps} from './TextProps';
|
||||
|
||||
import {createViewConfig} from '../NativeComponent/ViewConfig';
|
||||
@@ -21,7 +21,7 @@ export type NativeTextProps = $ReadOnly<{
|
||||
...TextProps,
|
||||
isHighlighted?: ?boolean,
|
||||
selectionColor?: ?ProcessedColorValue,
|
||||
onClick?: ?(event: PressEvent) => mixed,
|
||||
onClick?: ?(event: GestureResponderEvent) => mixed,
|
||||
// This is only needed for platforms that optimize text hit testing, e.g.,
|
||||
// react-native-windows. It can be used to only hit test virtual text spans
|
||||
// that have pressable events attached to them.
|
||||
|
||||
+9
-9
@@ -21,7 +21,7 @@ import type {ColorValue, TextStyleProp} from '../StyleSheet/StyleSheet';
|
||||
import type {
|
||||
LayoutChangeEvent,
|
||||
PointerEvent,
|
||||
PressEvent,
|
||||
GestureResponderEvent,
|
||||
TextLayoutEvent,
|
||||
} from '../Types/CoreEventTypes';
|
||||
import type {Node} from 'react';
|
||||
@@ -149,20 +149,20 @@ export type TextProps = $ReadOnly<{
|
||||
*
|
||||
* See https://reactnative.dev/docs/text#onlongpress
|
||||
*/
|
||||
onLongPress?: ?(event: PressEvent) => mixed,
|
||||
onLongPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
|
||||
/**
|
||||
* This function is called on press.
|
||||
*
|
||||
* See https://reactnative.dev/docs/text#onpress
|
||||
*/
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onResponderGrant?: ?(event: PressEvent) => void,
|
||||
onResponderMove?: ?(event: PressEvent) => void,
|
||||
onResponderRelease?: ?(event: PressEvent) => void,
|
||||
onResponderTerminate?: ?(event: PressEvent) => void,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
onResponderGrant?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderMove?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderRelease?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderTerminate?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderTerminationRequest?: ?() => boolean,
|
||||
onStartShouldSetResponder?: ?() => boolean,
|
||||
onMoveShouldSetResponder?: ?() => boolean,
|
||||
|
||||
+3
-3
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
import type {EventSubscription} from '../vendor/emitter/EventEmitter';
|
||||
import type {SyntheticEvent} from './CoreEventTypes';
|
||||
import type {NativeSyntheticEvent} from './CoreEventTypes';
|
||||
|
||||
// Event types
|
||||
// We're not using the PaperName, it is only used to codegen view config settings
|
||||
@@ -19,11 +19,11 @@ import type {SyntheticEvent} from './CoreEventTypes';
|
||||
export type BubblingEventHandler<
|
||||
T,
|
||||
PaperName: string | empty = empty, // eslint-disable-line no-unused-vars
|
||||
> = (event: SyntheticEvent<T>) => void | Promise<void>;
|
||||
> = (event: NativeSyntheticEvent<T>) => void | Promise<void>;
|
||||
export type DirectEventHandler<
|
||||
T,
|
||||
PaperName: string | empty = empty, // eslint-disable-line no-unused-vars
|
||||
> = (event: SyntheticEvent<T>) => void | Promise<void>;
|
||||
> = (event: NativeSyntheticEvent<T>) => void | Promise<void>;
|
||||
|
||||
// Prop types
|
||||
export type Double = number;
|
||||
|
||||
+95
-64
@@ -10,7 +10,7 @@
|
||||
|
||||
import type {HostInstance} from '../Renderer/shims/ReactNativeTypes';
|
||||
|
||||
export type SyntheticEvent<+T> = $ReadOnly<{
|
||||
export type NativeSyntheticEvent<+T> = $ReadOnly<{
|
||||
bubbles: ?boolean,
|
||||
cancelable: ?boolean,
|
||||
currentTarget: number | HostInstance,
|
||||
@@ -32,7 +32,7 @@ export type SyntheticEvent<+T> = $ReadOnly<{
|
||||
}>;
|
||||
|
||||
export type ResponderSyntheticEvent<T> = $ReadOnly<{
|
||||
...SyntheticEvent<T>,
|
||||
...NativeSyntheticEvent<T>,
|
||||
touchHistory: $ReadOnly<{
|
||||
indexOfSingleActiveTouch: number,
|
||||
mostRecentTimeStamp: number,
|
||||
@@ -70,7 +70,7 @@ export type TextLayoutLine = $ReadOnly<{
|
||||
xHeight: number,
|
||||
}>;
|
||||
|
||||
export type LayoutChangeEvent = SyntheticEvent<
|
||||
export type LayoutChangeEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
layout: LayoutRectangle,
|
||||
}>,
|
||||
@@ -80,7 +80,7 @@ export type TextLayoutEventData = $ReadOnly<{
|
||||
lines: Array<TextLayoutLine>,
|
||||
}>;
|
||||
|
||||
export type TextLayoutEvent = SyntheticEvent<TextLayoutEventData>;
|
||||
export type TextLayoutEvent = NativeSyntheticEvent<TextLayoutEventData>;
|
||||
|
||||
/**
|
||||
* https://developer.mozilla.org/en-US/docs/Web/API/UIEvent
|
||||
@@ -218,71 +218,102 @@ export interface NativePointerEvent extends NativeMouseEvent {
|
||||
+isPrimary: boolean;
|
||||
}
|
||||
|
||||
export type PointerEvent = SyntheticEvent<NativePointerEvent>;
|
||||
export type PointerEvent = NativeSyntheticEvent<NativePointerEvent>;
|
||||
|
||||
export type PressEvent = ResponderSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
changedTouches: $ReadOnlyArray<$PropertyType<PressEvent, 'nativeEvent'>>,
|
||||
force?: number,
|
||||
identifier: number,
|
||||
locationX: number,
|
||||
locationY: number,
|
||||
pageX: number,
|
||||
pageY: number,
|
||||
target: ?number,
|
||||
timestamp: number,
|
||||
touches: $ReadOnlyArray<$PropertyType<PressEvent, 'nativeEvent'>>,
|
||||
}>,
|
||||
>;
|
||||
export type NativeTouchEvent = $ReadOnly<{
|
||||
/**
|
||||
* Array of all touch events that have changed since the last event
|
||||
*/
|
||||
changedTouches: $ReadOnlyArray<NativeTouchEvent>,
|
||||
/**
|
||||
* 3D Touch reported force
|
||||
* @platform ios
|
||||
*/
|
||||
force?: number,
|
||||
/**
|
||||
* The ID of the touch
|
||||
*/
|
||||
identifier: number,
|
||||
/**
|
||||
* The X position of the touch, relative to the element
|
||||
*/
|
||||
locationX: number,
|
||||
/**
|
||||
* The Y position of the touch, relative to the element
|
||||
*/
|
||||
locationY: number,
|
||||
/**
|
||||
* The X position of the touch, relative to the screen
|
||||
*/
|
||||
pageX: number,
|
||||
/**
|
||||
* The Y position of the touch, relative to the screen
|
||||
*/
|
||||
pageY: number,
|
||||
/**
|
||||
* The node id of the element receiving the touch event
|
||||
*/
|
||||
target: ?number,
|
||||
/**
|
||||
* A time identifier for the touch, useful for velocity calculation
|
||||
*/
|
||||
timestamp: number,
|
||||
/**
|
||||
* Array of all current touches on the screen
|
||||
*/
|
||||
touches: $ReadOnlyArray<NativeTouchEvent>,
|
||||
}>;
|
||||
|
||||
export type ScrollEvent = SyntheticEvent<
|
||||
$ReadOnly<{
|
||||
contentInset: $ReadOnly<{
|
||||
bottom: number,
|
||||
left: number,
|
||||
right: number,
|
||||
top: number,
|
||||
}>,
|
||||
contentOffset: $ReadOnly<{
|
||||
y: number,
|
||||
x: number,
|
||||
}>,
|
||||
contentSize: $ReadOnly<{
|
||||
height: number,
|
||||
width: number,
|
||||
}>,
|
||||
layoutMeasurement: $ReadOnly<{
|
||||
height: number,
|
||||
width: number,
|
||||
}>,
|
||||
targetContentOffset?: $ReadOnly<{
|
||||
y: number,
|
||||
x: number,
|
||||
}>,
|
||||
velocity?: $ReadOnly<{
|
||||
y: number,
|
||||
x: number,
|
||||
}>,
|
||||
zoomScale?: number,
|
||||
responderIgnoreScroll?: boolean,
|
||||
}>,
|
||||
>;
|
||||
export type GestureResponderEvent = ResponderSyntheticEvent<NativeTouchEvent>;
|
||||
|
||||
export type BlurEvent = SyntheticEvent<
|
||||
$ReadOnly<{
|
||||
target: number,
|
||||
...
|
||||
}>,
|
||||
>;
|
||||
export type NativeScrollRectangle = $ReadOnly<{
|
||||
bottom: number,
|
||||
left: number,
|
||||
right: number,
|
||||
top: number,
|
||||
}>;
|
||||
|
||||
export type FocusEvent = SyntheticEvent<
|
||||
$ReadOnly<{
|
||||
target: number,
|
||||
...
|
||||
}>,
|
||||
>;
|
||||
export type NativeScrollPoint = $ReadOnly<{
|
||||
y: number,
|
||||
x: number,
|
||||
}>;
|
||||
|
||||
export type MouseEvent = SyntheticEvent<
|
||||
export type NativeScrollVelocity = $ReadOnly<{
|
||||
y: number,
|
||||
x: number,
|
||||
}>;
|
||||
|
||||
export type NativeScrollSize = $ReadOnly<{
|
||||
height: number,
|
||||
width: number,
|
||||
}>;
|
||||
|
||||
export type NativeScrollEvent = $ReadOnly<{
|
||||
contentInset: NativeScrollRectangle,
|
||||
contentOffset: NativeScrollPoint,
|
||||
contentSize: NativeScrollSize,
|
||||
layoutMeasurement: NativeScrollSize,
|
||||
velocity?: NativeScrollVelocity,
|
||||
zoomScale?: number,
|
||||
responderIgnoreScroll?: boolean,
|
||||
/**
|
||||
* @platform ios
|
||||
*/
|
||||
targetContentOffset?: NativeScrollPoint,
|
||||
}>;
|
||||
|
||||
export type ScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;
|
||||
|
||||
export type TargetedEvent = $ReadOnly<{
|
||||
target: number,
|
||||
...
|
||||
}>;
|
||||
|
||||
export type BlurEvent = NativeSyntheticEvent<TargetedEvent>;
|
||||
|
||||
export type FocusEvent = NativeSyntheticEvent<TargetedEvent>;
|
||||
|
||||
export type MouseEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
clientX: number,
|
||||
clientY: number,
|
||||
|
||||
@@ -1409,7 +1409,7 @@ declare export default typeof ActivityIndicatorViewNativeComponent;
|
||||
exports[`public API should not change unintentionally Libraries/Components/Button.js 1`] = `
|
||||
"type ButtonProps = $ReadOnly<{
|
||||
title: string,
|
||||
onPress: (event?: PressEvent) => mixed,
|
||||
onPress: (event?: GestureResponderEvent) => mixed,
|
||||
touchSoundDisabled?: ?boolean,
|
||||
color?: ?ColorValue,
|
||||
hasTVPreferredFocus?: ?boolean,
|
||||
@@ -1619,10 +1619,10 @@ type Props = $ReadOnly<{
|
||||
onLayout?: ?(event: LayoutChangeEvent) => mixed,
|
||||
onHoverIn?: ?(event: MouseEvent) => mixed,
|
||||
onHoverOut?: ?(event: MouseEvent) => mixed,
|
||||
onLongPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onLongPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
style?: ViewStyleProp | ((state: StateCallbackType) => ViewStyleProp),
|
||||
testID?: ?string,
|
||||
android_disableSound?: ?boolean,
|
||||
@@ -1655,9 +1655,9 @@ declare export default function useAndroidRippleForView(
|
||||
rippleConfig: ?RippleConfig,
|
||||
viewRef: { current: null | React.ElementRef<typeof View> }
|
||||
): ?$ReadOnly<{
|
||||
onPressIn: (event: PressEvent) => void,
|
||||
onPressMove: (event: PressEvent) => void,
|
||||
onPressOut: (event: PressEvent) => void,
|
||||
onPressIn: (event: GestureResponderEvent) => void,
|
||||
onPressMove: (event: GestureResponderEvent) => void,
|
||||
onPressOut: (event: GestureResponderEvent) => void,
|
||||
viewProps:
|
||||
| $ReadOnly<{ nativeBackgroundAndroid: NativeBackgroundProp }>
|
||||
| $ReadOnly<{ nativeForegroundAndroid: NativeBackgroundProp }>,
|
||||
@@ -2043,7 +2043,7 @@ exports[`public API should not change unintentionally Libraries/Components/Scrol
|
||||
snapToOffsets?: ?$ReadOnlyArray<number>,
|
||||
snapToStart?: ?boolean,
|
||||
zoomScale?: ?number,
|
||||
onResponderGrant?: ?(e: PressEvent) => void | boolean,
|
||||
onResponderGrant?: ?(e: GestureResponderEvent) => void | boolean,
|
||||
...
|
||||
}>;
|
||||
"
|
||||
@@ -2189,7 +2189,7 @@ declare export default typeof AndroidSwitchNativeComponent;
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Components/Switch/Switch.js 1`] = `
|
||||
"type SwitchChangeEvent = SyntheticEvent<
|
||||
"type SwitchChangeEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
value: boolean,
|
||||
target: number,
|
||||
@@ -2475,8 +2475,9 @@ export type TextInputChangeEventData = $ReadOnly<{
|
||||
target: number,
|
||||
text: string,
|
||||
}>;
|
||||
export type TextInputChangeEvent = SyntheticEvent<TextInputChangeEventData>;
|
||||
export type TextInputEvent = SyntheticEvent<
|
||||
export type TextInputChangeEvent =
|
||||
NativeSyntheticEvent<TextInputChangeEventData>;
|
||||
export type TextInputEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
eventCount: number,
|
||||
previousText: string,
|
||||
@@ -2496,13 +2497,13 @@ export type TextInputContentSizeChangeEventData = $ReadOnly<{
|
||||
}>,
|
||||
}>;
|
||||
export type TextInputContentSizeChangeEvent =
|
||||
SyntheticEvent<TextInputContentSizeChangeEventData>;
|
||||
NativeSyntheticEvent<TextInputContentSizeChangeEventData>;
|
||||
export type TargetEvent = $ReadOnly<{
|
||||
target: number,
|
||||
}>;
|
||||
export type TextInputFocusEventData = TargetEvent;
|
||||
export type TextInputBlurEvent = SyntheticEvent<TextInputFocusEventData>;
|
||||
export type TextInputFocusEvent = SyntheticEvent<TextInputFocusEventData>;
|
||||
export type TextInputBlurEvent = NativeSyntheticEvent<TextInputFocusEventData>;
|
||||
export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
|
||||
type Selection = $ReadOnly<{
|
||||
start: number,
|
||||
end: number,
|
||||
@@ -2512,21 +2513,22 @@ export type TextInputSelectionChangeEventData = $ReadOnly<{
|
||||
selection: Selection,
|
||||
}>;
|
||||
export type TextInputSelectionChangeEvent =
|
||||
SyntheticEvent<TextInputSelectionChangeEventData>;
|
||||
NativeSyntheticEvent<TextInputSelectionChangeEventData>;
|
||||
export type TextInputKeyPressEventData = $ReadOnly<{
|
||||
...TargetEvent,
|
||||
key: string,
|
||||
target?: ?number,
|
||||
eventCount: number,
|
||||
}>;
|
||||
export type TextInputKeyPressEvent = SyntheticEvent<TextInputKeyPressEventData>;
|
||||
export type TextInputKeyPressEvent =
|
||||
NativeSyntheticEvent<TextInputKeyPressEventData>;
|
||||
export type TextInputEndEditingEventData = $ReadOnly<{
|
||||
...TargetEvent,
|
||||
eventCount: number,
|
||||
text: string,
|
||||
}>;
|
||||
export type TextInputEditingEvent =
|
||||
SyntheticEvent<TextInputEndEditingEventData>;
|
||||
NativeSyntheticEvent<TextInputEndEditingEventData>;
|
||||
type DataDetectorTypesType =
|
||||
| \\"phoneNumber\\"
|
||||
| \\"link\\"
|
||||
@@ -2771,9 +2773,9 @@ export type TextInputProps = $ReadOnly<{
|
||||
onFocus?: ?(e: TextInputFocusEvent) => mixed,
|
||||
onKeyPress?: ?(e: TextInputKeyPressEvent) => mixed,
|
||||
unstable_onKeyPressSync?: ?(e: TextInputKeyPressEvent) => mixed,
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
onSelectionChange?: ?(e: TextInputSelectionChangeEvent) => mixed,
|
||||
onSubmitEditing?: ?(e: TextInputEditingEvent) => mixed,
|
||||
onScroll?: ?(e: ScrollEvent) => mixed,
|
||||
@@ -2830,8 +2832,9 @@ export type TextInputChangeEventData = $ReadOnly<{
|
||||
target: number,
|
||||
text: string,
|
||||
}>;
|
||||
export type TextInputChangeEvent = SyntheticEvent<TextInputChangeEventData>;
|
||||
export type TextInputEvent = SyntheticEvent<
|
||||
export type TextInputChangeEvent =
|
||||
NativeSyntheticEvent<TextInputChangeEventData>;
|
||||
export type TextInputEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
eventCount: number,
|
||||
previousText: string,
|
||||
@@ -2851,13 +2854,13 @@ export type TextInputContentSizeChangeEventData = $ReadOnly<{
|
||||
}>,
|
||||
}>;
|
||||
export type TextInputContentSizeChangeEvent =
|
||||
SyntheticEvent<TextInputContentSizeChangeEventData>;
|
||||
NativeSyntheticEvent<TextInputContentSizeChangeEventData>;
|
||||
export type TargetEvent = $ReadOnly<{
|
||||
target: number,
|
||||
}>;
|
||||
export type TextInputFocusEventData = TargetEvent;
|
||||
export type TextInputBlurEvent = SyntheticEvent<TextInputFocusEventData>;
|
||||
export type TextInputFocusEvent = SyntheticEvent<TextInputFocusEventData>;
|
||||
export type TextInputBlurEvent = NativeSyntheticEvent<TextInputFocusEventData>;
|
||||
export type TextInputFocusEvent = NativeSyntheticEvent<TextInputFocusEventData>;
|
||||
type Selection = $ReadOnly<{
|
||||
start: number,
|
||||
end: number,
|
||||
@@ -2867,21 +2870,22 @@ export type TextInputSelectionChangeEventData = $ReadOnly<{
|
||||
selection: Selection,
|
||||
}>;
|
||||
export type TextInputSelectionChangeEvent =
|
||||
SyntheticEvent<TextInputSelectionChangeEventData>;
|
||||
NativeSyntheticEvent<TextInputSelectionChangeEventData>;
|
||||
type TextInputKeyPressEventData = $ReadOnly<{
|
||||
...TargetEvent,
|
||||
key: string,
|
||||
target?: ?number,
|
||||
eventCount?: ?number,
|
||||
}>;
|
||||
export type TextInputKeyPressEvent = SyntheticEvent<TextInputKeyPressEventData>;
|
||||
export type TextInputKeyPressEvent =
|
||||
NativeSyntheticEvent<TextInputKeyPressEventData>;
|
||||
export type TextInputEndEditingEventData = $ReadOnly<{
|
||||
...TargetEvent,
|
||||
eventCount: number,
|
||||
text: string,
|
||||
}>;
|
||||
export type TextInputEditingEvent =
|
||||
SyntheticEvent<TextInputEndEditingEventData>;
|
||||
NativeSyntheticEvent<TextInputEndEditingEventData>;
|
||||
type DataDetectorTypesType =
|
||||
| \\"phoneNumber\\"
|
||||
| \\"link\\"
|
||||
@@ -3122,9 +3126,9 @@ export type TextInputProps = $ReadOnly<{
|
||||
onEndEditing?: ?(e: TextInputEditingEvent) => mixed,
|
||||
onFocus?: ?(e: TextInputFocusEvent) => mixed,
|
||||
onKeyPress?: ?(e: TextInputKeyPressEvent) => mixed,
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
onSelectionChange?: ?(e: TextInputSelectionChangeEvent) => mixed,
|
||||
onSubmitEditing?: ?(e: TextInputEditingEvent) => mixed,
|
||||
onScroll?: ?(e: ScrollEvent) => mixed,
|
||||
@@ -3306,16 +3310,16 @@ declare const TouchableMixin: {
|
||||
touchableGetInitialState: () => {
|
||||
touchable: {
|
||||
touchState: ?State,
|
||||
responderID: ?PressEvent[\\"currentTarget\\"],
|
||||
responderID: ?GestureResponderEvent[\\"currentTarget\\"],
|
||||
},
|
||||
},
|
||||
touchableHandleResponderTerminationRequest: () => any,
|
||||
touchableHandleStartShouldSetResponder: () => any,
|
||||
touchableLongPressCancelsPress: () => boolean,
|
||||
touchableHandleResponderGrant: (e: PressEvent) => void,
|
||||
touchableHandleResponderRelease: (e: PressEvent) => void,
|
||||
touchableHandleResponderTerminate: (e: PressEvent) => void,
|
||||
touchableHandleResponderMove: (e: PressEvent) => void,
|
||||
touchableHandleResponderGrant: (e: GestureResponderEvent) => void,
|
||||
touchableHandleResponderRelease: (e: GestureResponderEvent) => void,
|
||||
touchableHandleResponderTerminate: (e: GestureResponderEvent) => void,
|
||||
touchableHandleResponderMove: (e: GestureResponderEvent) => void,
|
||||
touchableHandleFocus: (e: Event) => void,
|
||||
touchableHandleBlur: (e: Event) => void,
|
||||
withoutDefaultFocusAndBlur: { ... },
|
||||
@@ -3506,10 +3510,10 @@ exports[`public API should not change unintentionally Libraries/Components/Touch
|
||||
onBlur?: ?(event: BlurEvent) => mixed,
|
||||
onFocus?: ?(event: FocusEvent) => mixed,
|
||||
onLayout?: ?(event: LayoutChangeEvent) => mixed,
|
||||
onLongPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onLongPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
pressRetentionOffset?: ?EdgeInsetsOrSizeProp,
|
||||
rejectResponderTermination?: ?boolean,
|
||||
testID?: ?string,
|
||||
@@ -3712,7 +3716,7 @@ export type AccessibilityActionInfo = $ReadOnly<{
|
||||
label?: string,
|
||||
...
|
||||
}>;
|
||||
export type AccessibilityActionEvent = SyntheticEvent<
|
||||
export type AccessibilityActionEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{ actionName: string, ... }>,
|
||||
>;
|
||||
export type AccessibilityState = {
|
||||
@@ -3828,28 +3832,28 @@ type FocusEventProps = $ReadOnly<{
|
||||
onFocusCapture?: ?(event: FocusEvent) => void,
|
||||
}>;
|
||||
type TouchEventProps = $ReadOnly<{
|
||||
onTouchCancel?: ?(e: PressEvent) => void,
|
||||
onTouchCancelCapture?: ?(e: PressEvent) => void,
|
||||
onTouchEnd?: ?(e: PressEvent) => void,
|
||||
onTouchEndCapture?: ?(e: PressEvent) => void,
|
||||
onTouchMove?: ?(e: PressEvent) => void,
|
||||
onTouchMoveCapture?: ?(e: PressEvent) => void,
|
||||
onTouchStart?: ?(e: PressEvent) => void,
|
||||
onTouchStartCapture?: ?(e: PressEvent) => void,
|
||||
onTouchCancel?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchCancelCapture?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchEnd?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchEndCapture?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchMove?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchMoveCapture?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchStart?: ?(e: GestureResponderEvent) => void,
|
||||
onTouchStartCapture?: ?(e: GestureResponderEvent) => void,
|
||||
}>;
|
||||
export type GestureResponderHandlers = $ReadOnly<{
|
||||
onMoveShouldSetResponder?: ?(e: PressEvent) => boolean,
|
||||
onMoveShouldSetResponderCapture?: ?(e: PressEvent) => boolean,
|
||||
onResponderGrant?: ?(e: PressEvent) => void | boolean,
|
||||
onResponderMove?: ?(e: PressEvent) => void,
|
||||
onResponderReject?: ?(e: PressEvent) => void,
|
||||
onResponderRelease?: ?(e: PressEvent) => void,
|
||||
onResponderStart?: ?(e: PressEvent) => void,
|
||||
onResponderEnd?: ?(e: PressEvent) => void,
|
||||
onResponderTerminate?: ?(e: PressEvent) => void,
|
||||
onResponderTerminationRequest?: ?(e: PressEvent) => boolean,
|
||||
onStartShouldSetResponder?: ?(e: PressEvent) => boolean,
|
||||
onStartShouldSetResponderCapture?: ?(e: PressEvent) => boolean,
|
||||
onMoveShouldSetResponder?: ?(e: GestureResponderEvent) => boolean,
|
||||
onMoveShouldSetResponderCapture?: ?(e: GestureResponderEvent) => boolean,
|
||||
onResponderGrant?: ?(e: GestureResponderEvent) => void | boolean,
|
||||
onResponderMove?: ?(e: GestureResponderEvent) => void,
|
||||
onResponderReject?: ?(e: GestureResponderEvent) => void,
|
||||
onResponderRelease?: ?(e: GestureResponderEvent) => void,
|
||||
onResponderStart?: ?(e: GestureResponderEvent) => void,
|
||||
onResponderEnd?: ?(e: GestureResponderEvent) => void,
|
||||
onResponderTerminate?: ?(e: GestureResponderEvent) => void,
|
||||
onResponderTerminationRequest?: ?(e: GestureResponderEvent) => boolean,
|
||||
onStartShouldSetResponder?: ?(e: GestureResponderEvent) => boolean,
|
||||
onStartShouldSetResponderCapture?: ?(e: GestureResponderEvent) => boolean,
|
||||
}>;
|
||||
type AndroidDrawableThemeAttr = $ReadOnly<{
|
||||
type: \\"ThemeAttrAndroid\\",
|
||||
@@ -3874,7 +3878,7 @@ export type ViewPropsAndroid = $ReadOnly<{
|
||||
nextFocusUp?: ?number,
|
||||
focusable?: boolean,
|
||||
tabIndex?: 0 | -1,
|
||||
onClick?: ?(event: PressEvent) => mixed,
|
||||
onClick?: ?(event: GestureResponderEvent) => mixed,
|
||||
}>;
|
||||
export type ViewPropsIOS = $ReadOnly<{
|
||||
shouldRasterizeIOS?: ?boolean,
|
||||
@@ -4431,7 +4435,7 @@ declare export function useWrapRefWithImageAttachedCallbacks(
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Image/ImageProps.js 1`] = `
|
||||
"export type ImageLoadEvent = SyntheticEvent<
|
||||
"export type ImageLoadEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
source: $ReadOnly<{
|
||||
width: number,
|
||||
@@ -4444,7 +4448,7 @@ type IOSImageProps = $ReadOnly<{
|
||||
defaultSource?: ?ImageSource,
|
||||
onPartialLoad?: ?() => void,
|
||||
onProgress?: ?(
|
||||
event: SyntheticEvent<$ReadOnly<{ loaded: number, total: number }>>
|
||||
event: NativeSyntheticEvent<$ReadOnly<{ loaded: number, total: number }>>
|
||||
) => void,
|
||||
}>;
|
||||
type AndroidImageProps = $ReadOnly<{
|
||||
@@ -4470,7 +4474,7 @@ export type ImageProps = $ReadOnly<{
|
||||
height?: number,
|
||||
width?: number,
|
||||
onError?: ?(
|
||||
event: SyntheticEvent<
|
||||
event: NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
error: string,
|
||||
}>,
|
||||
@@ -4822,23 +4826,26 @@ exports[`public API should not change unintentionally Libraries/Interaction/PanR
|
||||
numberActiveTouches: number,
|
||||
};
|
||||
type ActiveCallback = (
|
||||
event: PressEvent,
|
||||
event: GestureResponderEvent,
|
||||
gestureState: GestureState
|
||||
) => boolean;
|
||||
type PassiveCallback = (event: PressEvent, gestureState: GestureState) => mixed;
|
||||
type PassiveCallback = (
|
||||
event: GestureResponderEvent,
|
||||
gestureState: GestureState
|
||||
) => mixed;
|
||||
export type PanHandlers = {
|
||||
onMoveShouldSetResponder: (event: PressEvent) => boolean,
|
||||
onMoveShouldSetResponderCapture: (event: PressEvent) => boolean,
|
||||
onResponderEnd: (event: PressEvent) => void,
|
||||
onResponderGrant: (event: PressEvent) => boolean,
|
||||
onResponderMove: (event: PressEvent) => void,
|
||||
onResponderReject: (event: PressEvent) => void,
|
||||
onResponderRelease: (event: PressEvent) => void,
|
||||
onResponderStart: (event: PressEvent) => void,
|
||||
onResponderTerminate: (event: PressEvent) => void,
|
||||
onResponderTerminationRequest: (event: PressEvent) => boolean,
|
||||
onStartShouldSetResponder: (event: PressEvent) => boolean,
|
||||
onStartShouldSetResponderCapture: (event: PressEvent) => boolean,
|
||||
onMoveShouldSetResponder: (event: GestureResponderEvent) => boolean,
|
||||
onMoveShouldSetResponderCapture: (event: GestureResponderEvent) => boolean,
|
||||
onResponderEnd: (event: GestureResponderEvent) => void,
|
||||
onResponderGrant: (event: GestureResponderEvent) => boolean,
|
||||
onResponderMove: (event: GestureResponderEvent) => void,
|
||||
onResponderReject: (event: GestureResponderEvent) => void,
|
||||
onResponderRelease: (event: GestureResponderEvent) => void,
|
||||
onResponderStart: (event: GestureResponderEvent) => void,
|
||||
onResponderTerminate: (event: GestureResponderEvent) => void,
|
||||
onResponderTerminationRequest: (event: GestureResponderEvent) => boolean,
|
||||
onStartShouldSetResponder: (event: GestureResponderEvent) => boolean,
|
||||
onStartShouldSetResponderCapture: (event: GestureResponderEvent) => boolean,
|
||||
};
|
||||
type PanResponderConfig = $ReadOnly<{
|
||||
onMoveShouldSetPanResponder?: ?ActiveCallback,
|
||||
@@ -5530,7 +5537,7 @@ exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBox
|
||||
}>,
|
||||
children?: React.Node,
|
||||
hitSlop?: ?EdgeInsetsProp,
|
||||
onPress?: ?(event: PressEvent) => void,
|
||||
onPress?: ?(event: GestureResponderEvent) => void,
|
||||
style?: ViewStyleProp,
|
||||
}>;
|
||||
declare function LogBoxButton(props: Props): React.Node;
|
||||
@@ -5650,7 +5657,7 @@ declare export default typeof LogBoxInspectorSection;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorSourceMapStatus.js 1`] = `
|
||||
"type Props = $ReadOnly<{
|
||||
onPress?: ?(event: PressEvent) => void,
|
||||
onPress?: ?(event: GestureResponderEvent) => void,
|
||||
status: \\"COMPLETE\\" | \\"FAILED\\" | \\"NONE\\" | \\"PENDING\\",
|
||||
}>;
|
||||
declare function LogBoxInspectorSourceMapStatus(props: Props): React.Node;
|
||||
@@ -5661,7 +5668,7 @@ declare export default typeof LogBoxInspectorSourceMapStatus;
|
||||
exports[`public API should not change unintentionally Libraries/LogBox/UI/LogBoxInspectorStackFrame.js 1`] = `
|
||||
"type Props = $ReadOnly<{
|
||||
frame: StackFrame,
|
||||
onPress?: ?(event: PressEvent) => void,
|
||||
onPress?: ?(event: GestureResponderEvent) => void,
|
||||
}>;
|
||||
declare function LogBoxInspectorStackFrame(props: Props): React.Node;
|
||||
declare export default typeof LogBoxInspectorStackFrame;
|
||||
@@ -6372,25 +6379,25 @@ exports[`public API should not change unintentionally Libraries/Pressability/Pre
|
||||
onFocus?: ?(event: FocusEvent) => mixed,
|
||||
onHoverIn?: ?(event: MouseEvent) => mixed,
|
||||
onHoverOut?: ?(event: MouseEvent) => mixed,
|
||||
onLongPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressMove?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onLongPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressMove?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
blockNativeResponder?: ?boolean,
|
||||
}>;
|
||||
export type EventHandlers = $ReadOnly<{
|
||||
onBlur: (event: BlurEvent) => void,
|
||||
onClick: (event: PressEvent) => void,
|
||||
onClick: (event: GestureResponderEvent) => void,
|
||||
onFocus: (event: FocusEvent) => void,
|
||||
onMouseEnter?: (event: MouseEvent) => void,
|
||||
onMouseLeave?: (event: MouseEvent) => void,
|
||||
onPointerEnter?: (event: PointerEvent) => void,
|
||||
onPointerLeave?: (event: PointerEvent) => void,
|
||||
onResponderGrant: (event: PressEvent) => void | boolean,
|
||||
onResponderMove: (event: PressEvent) => void,
|
||||
onResponderRelease: (event: PressEvent) => void,
|
||||
onResponderTerminate: (event: PressEvent) => void,
|
||||
onResponderGrant: (event: GestureResponderEvent) => void | boolean,
|
||||
onResponderMove: (event: GestureResponderEvent) => void,
|
||||
onResponderRelease: (event: GestureResponderEvent) => void,
|
||||
onResponderTerminate: (event: GestureResponderEvent) => void,
|
||||
onResponderTerminationRequest: () => boolean,
|
||||
onStartShouldSetResponder: () => boolean,
|
||||
}>;
|
||||
@@ -7773,7 +7780,7 @@ exports[`public API should not change unintentionally Libraries/Text/TextNativeC
|
||||
...TextProps,
|
||||
isHighlighted?: ?boolean,
|
||||
selectionColor?: ?ProcessedColorValue,
|
||||
onClick?: ?(event: PressEvent) => mixed,
|
||||
onClick?: ?(event: GestureResponderEvent) => mixed,
|
||||
isPressable?: ?boolean,
|
||||
}>;
|
||||
declare export const NativeText: HostComponent<NativeTextProps>;
|
||||
@@ -7820,14 +7827,14 @@ export type TextProps = $ReadOnly<{
|
||||
nativeID?: ?string,
|
||||
numberOfLines?: ?number,
|
||||
onLayout?: ?(event: LayoutChangeEvent) => mixed,
|
||||
onLongPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPressIn?: ?(event: PressEvent) => mixed,
|
||||
onPressOut?: ?(event: PressEvent) => mixed,
|
||||
onResponderGrant?: ?(event: PressEvent) => void,
|
||||
onResponderMove?: ?(event: PressEvent) => void,
|
||||
onResponderRelease?: ?(event: PressEvent) => void,
|
||||
onResponderTerminate?: ?(event: PressEvent) => void,
|
||||
onLongPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressIn?: ?(event: GestureResponderEvent) => mixed,
|
||||
onPressOut?: ?(event: GestureResponderEvent) => mixed,
|
||||
onResponderGrant?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderMove?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderRelease?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderTerminate?: ?(event: GestureResponderEvent) => void,
|
||||
onResponderTerminationRequest?: ?() => boolean,
|
||||
onStartShouldSetResponder?: ?() => boolean,
|
||||
onMoveShouldSetResponder?: ?() => boolean,
|
||||
@@ -7885,10 +7892,10 @@ declare export default typeof NativeSampleTurboModule;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Types/CodegenTypes.js 1`] = `
|
||||
"export type BubblingEventHandler<T, PaperName: string | empty = empty> = (
|
||||
event: SyntheticEvent<T>
|
||||
event: NativeSyntheticEvent<T>
|
||||
) => void | Promise<void>;
|
||||
export type DirectEventHandler<T, PaperName: string | empty = empty> = (
|
||||
event: SyntheticEvent<T>
|
||||
event: NativeSyntheticEvent<T>
|
||||
) => void | Promise<void>;
|
||||
export type Double = number;
|
||||
export type Float = number;
|
||||
@@ -7904,7 +7911,7 @@ export type EventEmitter<T> = (
|
||||
`;
|
||||
|
||||
exports[`public API should not change unintentionally Libraries/Types/CoreEventTypes.js 1`] = `
|
||||
"export type SyntheticEvent<+T> = $ReadOnly<{
|
||||
"export type NativeSyntheticEvent<+T> = $ReadOnly<{
|
||||
bubbles: ?boolean,
|
||||
cancelable: ?boolean,
|
||||
currentTarget: number | HostInstance,
|
||||
@@ -7925,7 +7932,7 @@ exports[`public API should not change unintentionally Libraries/Types/CoreEventT
|
||||
type: ?string,
|
||||
}>;
|
||||
export type ResponderSyntheticEvent<T> = $ReadOnly<{
|
||||
...SyntheticEvent<T>,
|
||||
...NativeSyntheticEvent<T>,
|
||||
touchHistory: $ReadOnly<{
|
||||
indexOfSingleActiveTouch: number,
|
||||
mostRecentTimeStamp: number,
|
||||
@@ -7960,7 +7967,7 @@ export type TextLayoutLine = $ReadOnly<{
|
||||
text: string,
|
||||
xHeight: number,
|
||||
}>;
|
||||
export type LayoutChangeEvent = SyntheticEvent<
|
||||
export type LayoutChangeEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
layout: LayoutRectangle,
|
||||
}>,
|
||||
@@ -7968,7 +7975,7 @@ export type LayoutChangeEvent = SyntheticEvent<
|
||||
export type TextLayoutEventData = $ReadOnly<{
|
||||
lines: Array<TextLayoutLine>,
|
||||
}>;
|
||||
export type TextLayoutEvent = SyntheticEvent<TextLayoutEventData>;
|
||||
export type TextLayoutEvent = NativeSyntheticEvent<TextLayoutEventData>;
|
||||
export interface NativeUIEvent {
|
||||
+detail: number;
|
||||
}
|
||||
@@ -8003,66 +8010,56 @@ export interface NativePointerEvent extends NativeMouseEvent {
|
||||
+pointerType: string;
|
||||
+isPrimary: boolean;
|
||||
}
|
||||
export type PointerEvent = SyntheticEvent<NativePointerEvent>;
|
||||
export type PressEvent = ResponderSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
changedTouches: $ReadOnlyArray<$PropertyType<PressEvent, \\"nativeEvent\\">>,
|
||||
force?: number,
|
||||
identifier: number,
|
||||
locationX: number,
|
||||
locationY: number,
|
||||
pageX: number,
|
||||
pageY: number,
|
||||
target: ?number,
|
||||
timestamp: number,
|
||||
touches: $ReadOnlyArray<$PropertyType<PressEvent, \\"nativeEvent\\">>,
|
||||
}>,
|
||||
>;
|
||||
export type ScrollEvent = SyntheticEvent<
|
||||
$ReadOnly<{
|
||||
contentInset: $ReadOnly<{
|
||||
bottom: number,
|
||||
left: number,
|
||||
right: number,
|
||||
top: number,
|
||||
}>,
|
||||
contentOffset: $ReadOnly<{
|
||||
y: number,
|
||||
x: number,
|
||||
}>,
|
||||
contentSize: $ReadOnly<{
|
||||
height: number,
|
||||
width: number,
|
||||
}>,
|
||||
layoutMeasurement: $ReadOnly<{
|
||||
height: number,
|
||||
width: number,
|
||||
}>,
|
||||
targetContentOffset?: $ReadOnly<{
|
||||
y: number,
|
||||
x: number,
|
||||
}>,
|
||||
velocity?: $ReadOnly<{
|
||||
y: number,
|
||||
x: number,
|
||||
}>,
|
||||
zoomScale?: number,
|
||||
responderIgnoreScroll?: boolean,
|
||||
}>,
|
||||
>;
|
||||
export type BlurEvent = SyntheticEvent<
|
||||
$ReadOnly<{
|
||||
target: number,
|
||||
...
|
||||
}>,
|
||||
>;
|
||||
export type FocusEvent = SyntheticEvent<
|
||||
$ReadOnly<{
|
||||
target: number,
|
||||
...
|
||||
}>,
|
||||
>;
|
||||
export type MouseEvent = SyntheticEvent<
|
||||
export type PointerEvent = NativeSyntheticEvent<NativePointerEvent>;
|
||||
export type NativeTouchEvent = $ReadOnly<{
|
||||
changedTouches: $ReadOnlyArray<NativeTouchEvent>,
|
||||
force?: number,
|
||||
identifier: number,
|
||||
locationX: number,
|
||||
locationY: number,
|
||||
pageX: number,
|
||||
pageY: number,
|
||||
target: ?number,
|
||||
timestamp: number,
|
||||
touches: $ReadOnlyArray<NativeTouchEvent>,
|
||||
}>;
|
||||
export type GestureResponderEvent = ResponderSyntheticEvent<NativeTouchEvent>;
|
||||
export type NativeScrollRectangle = $ReadOnly<{
|
||||
bottom: number,
|
||||
left: number,
|
||||
right: number,
|
||||
top: number,
|
||||
}>;
|
||||
export type NativeScrollPoint = $ReadOnly<{
|
||||
y: number,
|
||||
x: number,
|
||||
}>;
|
||||
export type NativeScrollVelocity = $ReadOnly<{
|
||||
y: number,
|
||||
x: number,
|
||||
}>;
|
||||
export type NativeScrollSize = $ReadOnly<{
|
||||
height: number,
|
||||
width: number,
|
||||
}>;
|
||||
export type NativeScrollEvent = $ReadOnly<{
|
||||
contentInset: NativeScrollRectangle,
|
||||
contentOffset: NativeScrollPoint,
|
||||
contentSize: NativeScrollSize,
|
||||
layoutMeasurement: NativeScrollSize,
|
||||
velocity?: NativeScrollVelocity,
|
||||
zoomScale?: number,
|
||||
responderIgnoreScroll?: boolean,
|
||||
targetContentOffset?: NativeScrollPoint,
|
||||
}>;
|
||||
export type ScrollEvent = NativeSyntheticEvent<NativeScrollEvent>;
|
||||
export type TargetedEvent = $ReadOnly<{
|
||||
target: number,
|
||||
...
|
||||
}>;
|
||||
export type BlurEvent = NativeSyntheticEvent<TargetedEvent>;
|
||||
export type FocusEvent = NativeSyntheticEvent<TargetedEvent>;
|
||||
export type MouseEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{
|
||||
clientX: number,
|
||||
clientY: number,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PressEvent} from '../../../Libraries/Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../../../Libraries/Types/CoreEventTypes';
|
||||
import type {InspectedElement} from './Inspector';
|
||||
|
||||
import React from 'react';
|
||||
@@ -25,13 +25,13 @@ type Props = $ReadOnly<{
|
||||
}>;
|
||||
|
||||
function InspectorOverlay({inspected, onTouchPoint}: Props): React.Node {
|
||||
const findViewForTouchEvent = (e: PressEvent) => {
|
||||
const findViewForTouchEvent = (e: GestureResponderEvent) => {
|
||||
const {locationX, locationY} = e.nativeEvent.touches[0];
|
||||
|
||||
onTouchPoint(locationX, locationY);
|
||||
};
|
||||
|
||||
const handleStartShouldSetResponder = (e: PressEvent): boolean => {
|
||||
const handleStartShouldSetResponder = (e: GestureResponderEvent): boolean => {
|
||||
findViewForTouchEvent(e);
|
||||
return true;
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
import type {InspectedViewRef} from '../../../Libraries/ReactNative/AppContainer-dev';
|
||||
import type {PointerEvent} from '../../../Libraries/Types/CoreEventTypes';
|
||||
import type {PressEvent} from '../../../Libraries/Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from '../../../Libraries/Types/CoreEventTypes';
|
||||
import type {ReactDevToolsAgent} from '../../../Libraries/Types/ReactDevToolsTypes';
|
||||
import type {InspectedElement} from './Inspector';
|
||||
|
||||
@@ -107,7 +107,7 @@ export default function ReactDevToolsOverlay({
|
||||
);
|
||||
|
||||
const onResponderMove = useCallback(
|
||||
(e: PressEvent) => {
|
||||
(e: GestureResponderEvent) => {
|
||||
findViewForLocation(
|
||||
e.nativeEvent.touches[0].locationX,
|
||||
e.nativeEvent.touches[0].locationY,
|
||||
@@ -117,7 +117,7 @@ export default function ReactDevToolsOverlay({
|
||||
);
|
||||
|
||||
const shouldSetResponder = useCallback(
|
||||
(e: PressEvent): boolean => {
|
||||
(e: GestureResponderEvent): boolean => {
|
||||
onResponderMove(e);
|
||||
return true;
|
||||
},
|
||||
|
||||
@@ -12,11 +12,11 @@
|
||||
|
||||
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
|
||||
import type {HostComponent} from 'react-native/Libraries/Renderer/shims/ReactNativeTypes';
|
||||
import type {SyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
import type {NativeSyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
|
||||
const {requireNativeComponent} = require('react-native');
|
||||
|
||||
type SnapshotReadyEvent = SyntheticEvent<
|
||||
type SnapshotReadyEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{testIdentifier: string, ...}>,
|
||||
>;
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
import type {ViewStyleProp} from 'react-native/Libraries/StyleSheet/StyleSheet';
|
||||
import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
|
||||
import {RNTesterThemeContext} from './RNTesterTheme';
|
||||
import * as React from 'react';
|
||||
@@ -20,7 +20,7 @@ import {Pressable, StyleSheet, Text, View} from 'react-native';
|
||||
type Props = $ReadOnly<{
|
||||
testID?: ?string,
|
||||
label: string,
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
selected?: ?boolean,
|
||||
multiSelect?: ?boolean,
|
||||
disabled?: ?boolean,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
|
||||
import React from 'react';
|
||||
import {Pressable, StyleSheet, Text} from 'react-native';
|
||||
@@ -19,7 +19,7 @@ type Props = $ReadOnly<{
|
||||
testID?: string,
|
||||
textTestID?: string,
|
||||
children?: React.Node,
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
}>;
|
||||
|
||||
function RNTesterButton(props: Props): React.Node {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
|
||||
const React = require('react');
|
||||
const {Pressable, StyleSheet, Text} = require('react-native');
|
||||
@@ -19,7 +19,7 @@ type Props = $ReadOnly<{
|
||||
testID?: string,
|
||||
textTestID?: string,
|
||||
children?: React.Node,
|
||||
onPress?: ?(event: PressEvent) => mixed,
|
||||
onPress?: ?(event: GestureResponderEvent) => mixed,
|
||||
}>;
|
||||
|
||||
class RNTesterButton extends React.Component<Props> {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
import type {EventSubscription} from 'react-native/Libraries/vendor/emitter/EventEmitter';
|
||||
|
||||
import RNTesterBlock from '../../components/RNTesterBlock';
|
||||
@@ -1469,7 +1469,7 @@ class EnabledExample extends React.Component<
|
||||
this._subscription?.remove();
|
||||
}
|
||||
|
||||
_handleToggled = (isEnabled: void | PressEvent | boolean) => {
|
||||
_handleToggled = (isEnabled: void | GestureResponderEvent | boolean) => {
|
||||
if (!this.state.isEnabled) {
|
||||
this.setState({isEnabled: true});
|
||||
} else {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
import type {GestureState} from 'react-native/Libraries/Interaction/PanResponder';
|
||||
import type {PressEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
import type {GestureResponderEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
|
||||
import React from 'react';
|
||||
import {Animated, PanResponder, StyleSheet, View} from 'react-native';
|
||||
@@ -36,7 +36,10 @@ class AnExChained extends React.Component<Object, any> {
|
||||
}).start();
|
||||
this.state.stickers.push(sticker); // push on the followers
|
||||
}
|
||||
const releaseChain = (e: PressEvent, gestureState: GestureState) => {
|
||||
const releaseChain = (
|
||||
e: GestureResponderEvent,
|
||||
gestureState: GestureState,
|
||||
) => {
|
||||
this.state.stickers[0].flattenOffset(); // merges offset into value and resets
|
||||
Animated.sequence([
|
||||
// spring to start after decay finishes
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
'use strict';
|
||||
|
||||
import type {ViewProps} from 'react-native/Libraries/Components/View/ViewPropTypes';
|
||||
import type {SyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
import type {NativeSyntheticEvent} from 'react-native/Libraries/Types/CoreEventTypes';
|
||||
|
||||
const React = require('react');
|
||||
const {NativeModules, StyleSheet, UIManager, View} = require('react-native');
|
||||
@@ -25,7 +25,7 @@ const RCTSnapshot = UIManager.hasViewManagerConfig('RCTSnapshot')
|
||||
? require('../../../RCTTest/RCTSnapshotNativeComponent')
|
||||
: View;
|
||||
|
||||
type SnapshotReadyEvent = SyntheticEvent<
|
||||
type SnapshotReadyEvent = NativeSyntheticEvent<
|
||||
$ReadOnly<{testIdentifier: string, ...}>,
|
||||
>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user