Skip to content

Commit

Permalink
Move eventSystemFlags to last argument in event plugin extractors (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
necolas committed Oct 2, 2019
1 parent f6efb22 commit ab1a4f2
Show file tree
Hide file tree
Showing 14 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions packages/legacy-events/EventPluginHub.js
Expand Up @@ -132,10 +132,10 @@ export function getListener(inst: Fiber, registrationName: string) {
*/
function extractPluginEvents(
topLevelType: TopLevelType,
eventSystemFlags: EventSystemFlags,
targetInst: null | Fiber,
nativeEvent: AnyNativeEvent,
nativeEventTarget: EventTarget,
eventSystemFlags: EventSystemFlags,
): Array<ReactSyntheticEvent> | ReactSyntheticEvent | null {
let events = null;
for (let i = 0; i < plugins.length; i++) {
Expand All @@ -144,10 +144,10 @@ function extractPluginEvents(
if (possiblePlugin) {
const extractedEvents = possiblePlugin.extractEvents(
topLevelType,
eventSystemFlags,
targetInst,
nativeEvent,
nativeEventTarget,
eventSystemFlags,
);
if (extractedEvents) {
events = accumulateInto(events, extractedEvents);
Expand All @@ -159,17 +159,17 @@ function extractPluginEvents(

export function runExtractedPluginEventsInBatch(
topLevelType: TopLevelType,
eventSystemFlags: EventSystemFlags,
targetInst: null | Fiber,
nativeEvent: AnyNativeEvent,
nativeEventTarget: EventTarget,
eventSystemFlags: EventSystemFlags,
) {
const events = extractPluginEvents(
topLevelType,
eventSystemFlags,
targetInst,
nativeEvent,
nativeEventTarget,
eventSystemFlags,
);
runEventsInBatch(events);
}
2 changes: 1 addition & 1 deletion packages/legacy-events/PluginModuleType.js
Expand Up @@ -25,10 +25,10 @@ export type PluginModule<NativeEvent> = {
eventTypes: EventTypes,
extractEvents: (
topLevelType: TopLevelType,
eventSystemFlags: EventSystemFlags,
targetInst: null | Fiber,
nativeTarget: NativeEvent,
nativeEventTarget: EventTarget,
eventSystemFlags: EventSystemFlags,
) => ?ReactSyntheticEvent,
tapMoveThreshold?: number,
};
2 changes: 1 addition & 1 deletion packages/legacy-events/ResponderEventPlugin.js
Expand Up @@ -504,10 +504,10 @@ const ResponderEventPlugin = {
*/
extractEvents: function(
topLevelType,
eventSystemFlags,
targetInst,
nativeEvent,
nativeEventTarget,
eventSystemFlags,
) {
if (isStartish(topLevelType)) {
trackedTouchCount += 1;
Expand Down
Expand Up @@ -314,10 +314,10 @@ const run = function(config, hierarchyConfig, nativeEventConfig) {
// Trigger the event
const extractedEvents = ResponderEventPlugin.extractEvents(
nativeEventConfig.topLevelType,
PLUGIN_EVENT_SYSTEM,
nativeEventConfig.targetInst,
nativeEventConfig.nativeEvent,
nativeEventConfig.target,
PLUGIN_EVENT_SYSTEM,
);

// At this point the negotiation events have been dispatched as part of the
Expand Down
4 changes: 2 additions & 2 deletions packages/react-devtools-shell/src/app/ReactNativeWeb/index.js
Expand Up @@ -11,7 +11,7 @@ import React, {Fragment, useState} from 'react';
import {Button, Text, View} from 'react-native-web';

export default function ReactNativeWeb() {
const [backgroundColor, setBackgroundColor] = useState('blue');
const [backgroundColor, setBackgroundColor] = useState('purple');
const toggleColor = () =>
setBackgroundColor(backgroundColor === 'purple' ? 'green' : 'purple');
return (
Expand All @@ -29,8 +29,8 @@ export default function ReactNativeWeb() {
left
</Text>
<Button
color={backgroundColor}
onPress={toggleColor}
style={{backgroundColor}}
title={`Switch background color to "${
backgroundColor === 'purple' ? 'green' : 'purple'
}"`}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/events/BeforeInputEventPlugin.js
Expand Up @@ -464,10 +464,10 @@ const BeforeInputEventPlugin = {

extractEvents: function(
topLevelType,
eventSystemFlags,
targetInst,
nativeEvent,
nativeEventTarget,
eventSystemFlags,
) {
const composition = extractCompositionEvent(
topLevelType,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/events/ChangeEventPlugin.js
Expand Up @@ -262,10 +262,10 @@ const ChangeEventPlugin = {

extractEvents: function(
topLevelType,
eventSystemFlags,
targetInst,
nativeEvent,
nativeEventTarget,
eventSystemFlags,
) {
const targetNode = targetInst ? getNodeFromInstance(targetInst) : window;

Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/events/EnterLeaveEventPlugin.js
Expand Up @@ -54,10 +54,10 @@ const EnterLeaveEventPlugin = {
*/
extractEvents: function(
topLevelType,
eventSystemFlags,
targetInst,
nativeEvent,
nativeEventTarget,
eventSystemFlags,
) {
const isOverEvent =
topLevelType === TOP_MOUSE_OVER || topLevelType === TOP_POINTER_OVER;
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/events/ReactDOMEventListener.js
Expand Up @@ -178,10 +178,10 @@ function handleTopLevel(bookKeeping: BookKeepingInstance) {

runExtractedPluginEventsInBatch(
topLevelType,
bookKeeping.eventSystemFlags,
targetInst,
nativeEvent,
eventTarget,
bookKeeping.eventSystemFlags,
);
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/events/SelectEventPlugin.js
Expand Up @@ -162,10 +162,10 @@ const SelectEventPlugin = {

extractEvents: function(
topLevelType,
eventSystemFlags,
targetInst,
nativeEvent,
nativeEventTarget,
eventSystemFlags,
) {
const doc = getEventTargetDocument(nativeEventTarget);
// Track whether all listeners exists for this plugin. If none exist, we do
Expand Down
2 changes: 1 addition & 1 deletion packages/react-dom/src/events/SimpleEventPlugin.js
Expand Up @@ -248,10 +248,10 @@ const SimpleEventPlugin: PluginModule<MouseEvent> & {

extractEvents: function(
topLevelType: TopLevelType,
eventSystemFlags: EventSystemFlags,
targetInst: null | Fiber,
nativeEvent: MouseEvent,
nativeEventTarget: EventTarget,
eventSystemFlags: EventSystemFlags,
): null | ReactSyntheticEvent {
const dispatchConfig = topLevelEventsToDispatchConfig[topLevelType];
if (!dispatchConfig) {
Expand Down
Expand Up @@ -42,10 +42,10 @@ export function dispatchEvent(
// Heritage plugin event system
runExtractedPluginEventsInBatch(
topLevelType,
PLUGIN_EVENT_SYSTEM,
targetFiber,
nativeEvent,
nativeEvent.target,
PLUGIN_EVENT_SYSTEM,
);
});
// React Native doesn't use ReactControlledComponent but if it did, here's
Expand Down
Expand Up @@ -33,10 +33,10 @@ const ReactNativeBridgeEventPlugin = {
*/
extractEvents: function(
topLevelType: TopLevelType,
eventSystemFlags: EventSystemFlags,
targetInst: null | Object,
nativeEvent: AnyNativeEvent,
nativeEventTarget: Object,
eventSystemFlags: EventSystemFlags,
): ?Object {
if (targetInst == null) {
// Probably a node belonging to another renderer's tree.
Expand Down
Expand Up @@ -101,10 +101,10 @@ function _receiveRootNodeIDEvent(
batchedUpdates(function() {
runExtractedPluginEventsInBatch(
topLevelType,
PLUGIN_EVENT_SYSTEM,
inst,
nativeEvent,
nativeEvent.target,
PLUGIN_EVENT_SYSTEM,
);
});
// React Native doesn't use ReactControlledComponent but if it did, here's
Expand Down

0 comments on commit ab1a4f2

Please sign in to comment.