Skip to content
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
3 changes: 1 addition & 2 deletions packages/react-dom/src/events/DOMEventResponderSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import type {
ReactEventComponentInstance,
ReactResponderContext,
ReactResponderEvent,
ReactResponderDispatchEventOptions,
} from 'shared/ReactTypes';
import type {DOMTopLevelEventType} from 'events/TopLevelEventTypes';
import {batchedUpdates, interactiveUpdates} from 'events/ReactGenericBatching';
Expand Down Expand Up @@ -104,7 +103,7 @@ const eventResponderContext: ReactResponderContext = {
dispatchEvent(
possibleEventObject: Object,
listener: ($Shape<PartialEventObject>) => void,
{discrete}: ReactResponderDispatchEventOptions,
discrete: boolean,
): void {
validateResponderContext();
const {target, type, timeStamp} = possibleEventObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -403,9 +403,7 @@ describe('DOMEventResponderSystem', () => {
phase: 'bubble',
timeStamp: context.getTimeStamp(),
};
context.dispatchEvent(syntheticEvent, props.onMagicClick, {
discrete: true,
});
context.dispatchEvent(syntheticEvent, props.onMagicClick, true);
}
},
onEventCapture: (event, context, props) => {
Expand All @@ -416,9 +414,7 @@ describe('DOMEventResponderSystem', () => {
phase: 'capture',
timeStamp: context.getTimeStamp(),
};
context.dispatchEvent(syntheticEvent, props.onMagicClick, {
discrete: true,
});
context.dispatchEvent(syntheticEvent, props.onMagicClick, true);
}
},
});
Expand Down Expand Up @@ -460,7 +456,7 @@ describe('DOMEventResponderSystem', () => {
phase,
timeStamp: context.getTimeStamp(),
};
context.dispatchEvent(pressEvent, props.onPress, {discrete: true});
context.dispatchEvent(pressEvent, props.onPress, true);

context.setTimeout(() => {
if (props.onLongPress) {
Expand All @@ -470,9 +466,7 @@ describe('DOMEventResponderSystem', () => {
phase,
timeStamp: context.getTimeStamp(),
};
context.dispatchEvent(longPressEvent, props.onLongPress, {
discrete: true,
});
context.dispatchEvent(longPressEvent, props.onLongPress, true);
}

if (props.onLongPressChange) {
Expand All @@ -482,9 +476,11 @@ describe('DOMEventResponderSystem', () => {
phase,
timeStamp: context.getTimeStamp(),
};
context.dispatchEvent(longPressChangeEvent, props.onLongPressChange, {
discrete: true,
});
context.dispatchEvent(
longPressChangeEvent,
props.onLongPressChange,
true,
);
}
}, 500);
}
Expand Down Expand Up @@ -842,9 +838,7 @@ describe('DOMEventResponderSystem', () => {
type: 'click',
timeStamp: context.getTimeStamp(),
};
context.dispatchEvent(syntheticEvent, props.onClick, {
discrete: true,
});
context.dispatchEvent(syntheticEvent, props.onClick, true);
},
});

Expand Down
2 changes: 1 addition & 1 deletion packages/react-events/src/Drag.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function dispatchDragEvent(
): void {
const target = ((state.dragTarget: any): Element | Document);
const syntheticEvent = createDragEvent(context, name, target, eventData);
context.dispatchEvent(syntheticEvent, listener, {discrete});
context.dispatchEvent(syntheticEvent, listener, discrete);
}

const DragResponder = {
Expand Down
12 changes: 6 additions & 6 deletions packages/react-events/src/Focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ function dispatchFocusInEvents(
target,
pointerType,
);
context.dispatchEvent(syntheticEvent, props.onFocus, {discrete: true});
context.dispatchEvent(syntheticEvent, props.onFocus, true);
}
if (props.onFocusChange) {
const listener = () => {
Expand All @@ -105,7 +105,7 @@ function dispatchFocusInEvents(
target,
pointerType,
);
context.dispatchEvent(syntheticEvent, listener, {discrete: true});
context.dispatchEvent(syntheticEvent, listener, true);
}
if (props.onFocusVisibleChange && state.isLocalFocusVisible) {
const listener = () => {
Expand All @@ -117,7 +117,7 @@ function dispatchFocusInEvents(
target,
pointerType,
);
context.dispatchEvent(syntheticEvent, listener, {discrete: true});
context.dispatchEvent(syntheticEvent, listener, true);
}
}

Expand All @@ -135,7 +135,7 @@ function dispatchFocusOutEvents(
target,
pointerType,
);
context.dispatchEvent(syntheticEvent, props.onBlur, {discrete: true});
context.dispatchEvent(syntheticEvent, props.onBlur, true);
}
if (props.onFocusChange) {
const listener = () => {
Expand All @@ -147,7 +147,7 @@ function dispatchFocusOutEvents(
target,
pointerType,
);
context.dispatchEvent(syntheticEvent, listener, {discrete: true});
context.dispatchEvent(syntheticEvent, listener, true);
}
dispatchFocusVisibleOutEvent(context, props, state);
}
Expand All @@ -169,7 +169,7 @@ function dispatchFocusVisibleOutEvent(
target,
pointerType,
);
context.dispatchEvent(syntheticEvent, listener, {discrete: true});
context.dispatchEvent(syntheticEvent, listener, true);
state.isLocalFocusVisible = false;
}
}
Expand Down
16 changes: 8 additions & 8 deletions packages/react-events/src/Hover.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function dispatchHoverChangeEvent(
'hoverchange',
((state.hoverTarget: any): Element | Document),
);
context.dispatchEvent(syntheticEvent, listener, {discrete: true});
context.dispatchEvent(syntheticEvent, listener, true);
}

function dispatchHoverStartEvents(
Expand Down Expand Up @@ -123,9 +123,7 @@ function dispatchHoverStartEvents(
'hoverstart',
((target: any): Element | Document),
);
context.dispatchEvent(syntheticEvent, props.onHoverStart, {
discrete: true,
});
context.dispatchEvent(syntheticEvent, props.onHoverStart, true);
}
if (props.onHoverChange) {
dispatchHoverChangeEvent(context, props, state);
Expand Down Expand Up @@ -183,7 +181,7 @@ function dispatchHoverEndEvents(
'hoverend',
((target: any): Element | Document),
);
context.dispatchEvent(syntheticEvent, props.onHoverEnd, {discrete: true});
context.dispatchEvent(syntheticEvent, props.onHoverEnd, true);
}
if (props.onHoverChange) {
dispatchHoverChangeEvent(context, props, state);
Expand Down Expand Up @@ -322,9 +320,11 @@ const HoverResponder = {
'hovermove',
state.hoverTarget,
);
context.dispatchEvent(syntheticEvent, props.onHoverMove, {
discrete: false,
});
context.dispatchEvent(
syntheticEvent,
props.onHoverMove,
true,
);
}
}
}
Expand Down
4 changes: 1 addition & 3 deletions packages/react-events/src/Press.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,7 @@ function dispatchEvent(
pointerType,
event,
);
context.dispatchEvent(syntheticEvent, listener, {
discrete,
});
context.dispatchEvent(syntheticEvent, listener, discrete);
}

function dispatchPressChangeEvent(
Expand Down
2 changes: 1 addition & 1 deletion packages/react-events/src/Swipe.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function dispatchSwipeEvent(
) {
const target = ((state.swipeTarget: any): Element | Document);
const syntheticEvent = createSwipeEvent(context, name, target, eventData);
context.dispatchEvent(syntheticEvent, listener, {discrete});
context.dispatchEvent(syntheticEvent, listener, discrete);
}

type SwipeState = {
Expand Down
6 changes: 1 addition & 5 deletions packages/shared/ReactTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,15 +158,11 @@ export type ReactResponderEvent = {
passiveSupported: boolean,
};

export type ReactResponderDispatchEventOptions = {
discrete?: boolean,
};

export type ReactResponderContext = {
dispatchEvent: (
eventObject: Object,
listener: (Object) => void,
options: ReactResponderDispatchEventOptions,
discrete: boolean,
) => void,
isTargetWithinElement: (
childTarget: Element | Document,
Expand Down