Skip to content

Move EventTypes to ReactTypes #15364

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 0 additions & 53 deletions packages/events/EventTypes.js

This file was deleted.

16 changes: 7 additions & 9 deletions packages/react-dom/src/events/DOMEventResponderSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@
* @flow
*/

import type {
ResponderContext,
ResponderEvent,
ResponderDispatchEventOptions,
} from 'events/EventTypes';
import {
type EventSystemFlags,
IS_PASSIVE,
Expand All @@ -24,6 +19,9 @@ import {
import type {
ReactEventResponderEventType,
ReactEventComponentInstance,
ReactResponderContext,
ReactResponderEvent,
ReactResponderDispatchEventOptions,
} from 'shared/ReactTypes';
import type {DOMTopLevelEventType} from 'events/TopLevelEventTypes';
import {batchedUpdates, interactiveUpdates} from 'events/ReactGenericBatching';
Expand Down Expand Up @@ -58,10 +56,10 @@ let currentOwner = null;
let currentInstance: ReactEventComponentInstance;
let currentEventQueue: EventQueue;

const eventResponderContext: ResponderContext = {
const eventResponderContext: ReactResponderContext = {
dispatchEvent(
possibleEventObject: Object,
{capture, discrete, stopPropagation}: ResponderDispatchEventOptions,
{capture, discrete, stopPropagation}: ReactResponderDispatchEventOptions,
): void {
const eventQueue = currentEventQueue;
const {listener, target, type} = possibleEventObject;
Expand Down Expand Up @@ -260,7 +258,7 @@ function createResponderEvent(
nativeEvent: AnyNativeEvent,
nativeEventTarget: Element | Document,
eventSystemFlags: EventSystemFlags,
): ResponderEvent {
): ReactResponderEvent {
return {
nativeEvent: nativeEvent,
target: nativeEventTarget,
Expand Down Expand Up @@ -342,7 +340,7 @@ function getTargetEventTypes(

function handleTopLevelType(
topLevelType: DOMTopLevelEventType,
responderEvent: ResponderEvent,
responderEvent: ReactResponderEvent,
eventComponentInstance: ReactEventComponentInstance,
isRootLevelEvent: boolean,
): void {
Expand Down
11 changes: 7 additions & 4 deletions packages/react-events/src/Drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
* @flow
*/

import type {ResponderEvent, ResponderContext} from 'events/EventTypes';
import type {
ReactResponderEvent,
ReactResponderContext,
} from 'shared/ReactTypes';
import {REACT_EVENT_COMPONENT_TYPE} from 'shared/ReactSymbols';

const targetEventTypes = ['pointerdown', 'pointercancel'];
Expand Down Expand Up @@ -62,7 +65,7 @@ function createDragEvent(
}

function dispatchDragEvent(
context: ResponderContext,
context: ReactResponderContext,
name: DragEventType,
listener: DragEvent => void,
state: DragState,
Expand All @@ -88,8 +91,8 @@ const DragResponder = {
};
},
onEvent(
event: ResponderEvent,
context: ResponderContext,
event: ReactResponderEvent,
context: ReactResponderContext,
props: Object,
state: DragState,
): void {
Expand Down
17 changes: 10 additions & 7 deletions packages/react-events/src/Focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
* @flow
*/

import type {ResponderEvent, ResponderContext} from 'events/EventTypes';
import type {
ReactResponderEvent,
ReactResponderContext,
} from 'shared/ReactTypes';
import {REACT_EVENT_COMPONENT_TYPE} from 'shared/ReactSymbols';

type FocusProps = {
Expand Down Expand Up @@ -47,8 +50,8 @@ function createFocusEvent(
}

function dispatchFocusInEvents(
event: ResponderEvent,
context: ResponderContext,
event: ReactResponderEvent,
context: ReactResponderContext,
props: FocusProps,
) {
const {nativeEvent, target} = event;
Expand All @@ -69,8 +72,8 @@ function dispatchFocusInEvents(
}

function dispatchFocusOutEvents(
event: ResponderEvent,
context: ResponderContext,
event: ReactResponderEvent,
context: ReactResponderContext,
props: FocusProps,
) {
const {nativeEvent, target} = event;
Expand Down Expand Up @@ -98,8 +101,8 @@ const FocusResponder = {
};
},
onEvent(
event: ResponderEvent,
context: ResponderContext,
event: ReactResponderEvent,
context: ReactResponderContext,
props: Object,
state: FocusState,
): void {
Expand Down
21 changes: 12 additions & 9 deletions packages/react-events/src/Hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
* @flow
*/

import type {ResponderEvent, ResponderContext} from 'events/EventTypes';
import type {
ReactResponderEvent,
ReactResponderContext,
} from 'shared/ReactTypes';
import {REACT_EVENT_COMPONENT_TYPE} from 'shared/ReactSymbols';

type HoverProps = {
Expand Down Expand Up @@ -64,8 +67,8 @@ function createHoverEvent(
}

function dispatchHoverChangeEvent(
event: ResponderEvent,
context: ResponderContext,
event: ReactResponderEvent,
context: ReactResponderContext,
props: HoverProps,
state: HoverState,
): void {
Expand All @@ -81,8 +84,8 @@ function dispatchHoverChangeEvent(
}

function dispatchHoverStartEvents(
event: ResponderEvent,
context: ResponderContext,
event: ReactResponderEvent,
context: ReactResponderContext,
props: HoverProps,
state: HoverState,
): void {
Expand Down Expand Up @@ -132,8 +135,8 @@ function dispatchHoverStartEvents(
}

function dispatchHoverEndEvents(
event: ResponderEvent,
context: ResponderContext,
event: ReactResponderEvent,
context: ReactResponderContext,
props: HoverProps,
state: HoverState,
) {
Expand Down Expand Up @@ -199,8 +202,8 @@ const HoverResponder = {
};
},
onEvent(
event: ResponderEvent,
context: ResponderContext,
event: ReactResponderEvent,
context: ReactResponderContext,
props: HoverProps,
state: HoverState,
): void {
Expand Down
29 changes: 18 additions & 11 deletions packages/react-events/src/Press.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
* @flow
*/

import type {ResponderEvent, ResponderContext} from 'events/EventTypes';
import type {
ReactResponderEvent,
ReactResponderContext,
} from 'shared/ReactTypes';
import {REACT_EVENT_COMPONENT_TYPE} from 'shared/ReactSymbols';

type PressProps = {
Expand Down Expand Up @@ -89,7 +92,7 @@ function createPressEvent(
}

function dispatchEvent(
context: ResponderContext,
context: ReactResponderContext,
state: PressState,
name: PressEventType,
listener: (e: Object) => void,
Expand All @@ -100,7 +103,7 @@ function dispatchEvent(
}

function dispatchPressChangeEvent(
context: ResponderContext,
context: ReactResponderContext,
props: PressProps,
state: PressState,
): void {
Expand All @@ -111,7 +114,7 @@ function dispatchPressChangeEvent(
}

function dispatchLongPressChangeEvent(
context: ResponderContext,
context: ReactResponderContext,
props: PressProps,
state: PressState,
): void {
Expand Down Expand Up @@ -150,7 +153,7 @@ function deactivate(context, props, state) {
}

function dispatchPressStartEvents(
context: ResponderContext,
context: ReactResponderContext,
props: PressProps,
state: PressState,
): void {
Expand Down Expand Up @@ -212,7 +215,7 @@ function dispatchPressStartEvents(
}

function dispatchPressEndEvents(
context: ResponderContext,
context: ReactResponderContext,
props: PressProps,
state: PressState,
): void {
Expand Down Expand Up @@ -265,7 +268,7 @@ function calculateDelayMS(delay: ?number, min = 0, fallback = 0) {
}

function unmountResponder(
context: ResponderContext,
context: ReactResponderContext,
props: PressProps,
state: PressState,
): void {
Expand Down Expand Up @@ -293,8 +296,8 @@ const PressResponder = {
};
},
onEvent(
event: ResponderEvent,
context: ResponderContext,
event: ReactResponderEvent,
context: ReactResponderContext,
props: PressProps,
state: PressState,
): void {
Expand Down Expand Up @@ -491,12 +494,16 @@ const PressResponder = {
}
}
},
onUnmount(context: ResponderContext, props: PressProps, state: PressState) {
onUnmount(
context: ReactResponderContext,
props: PressProps,
state: PressState,
) {
unmountResponder(context, props, state);
},
// TODO This method doesn't work as of yet
onOwnershipChange(
context: ResponderContext,
context: ReactResponderContext,
props: PressProps,
state: PressState,
) {
Expand Down
11 changes: 7 additions & 4 deletions packages/react-events/src/Swipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
* @flow
*/

import type {ResponderEvent, ResponderContext} from 'events/EventTypes';
import type {
ReactResponderEvent,
ReactResponderContext,
} from 'shared/ReactTypes';
import {REACT_EVENT_COMPONENT_TYPE} from 'shared/ReactSymbols';

const targetEventTypes = ['pointerdown', 'pointercancel'];
Expand Down Expand Up @@ -52,7 +55,7 @@ function createSwipeEvent(
}

function dispatchSwipeEvent(
context: ResponderContext,
context: ReactResponderContext,
name: SwipeEventType,
listener: SwipeEvent => void,
state: SwipeState,
Expand Down Expand Up @@ -92,8 +95,8 @@ const SwipeResponder = {
};
},
onEvent(
event: ResponderEvent,
context: ResponderContext,
event: ReactResponderEvent,
context: ReactResponderContext,
props: Object,
state: SwipeState,
): void {
Expand Down
Loading