Skip to content

Event Replaying #16725

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 12 commits into from
Sep 23, 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
5 changes: 5 additions & 0 deletions packages/legacy-events/EventPluginHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type {ReactSyntheticEvent} from './ReactSyntheticEventType';
import type {Fiber} from 'react-reconciler/src/ReactFiber';
import type {AnyNativeEvent} from './PluginModuleType';
import type {TopLevelType} from './TopLevelEventTypes';
import type {EventSystemFlags} from 'legacy-events/EventSystemFlags';

function isInteractive(tag) {
return (
Expand Down Expand Up @@ -131,6 +132,7 @@ export function getListener(inst: Fiber, registrationName: string) {
*/
function extractPluginEvents(
topLevelType: TopLevelType,
eventSystemFlags: EventSystemFlags,
targetInst: null | Fiber,
nativeEvent: AnyNativeEvent,
nativeEventTarget: EventTarget,
Expand All @@ -142,6 +144,7 @@ function extractPluginEvents(
if (possiblePlugin) {
const extractedEvents = possiblePlugin.extractEvents(
topLevelType,
eventSystemFlags,
targetInst,
nativeEvent,
nativeEventTarget,
Expand All @@ -156,12 +159,14 @@ function extractPluginEvents(

export function runExtractedPluginEventsInBatch(
topLevelType: TopLevelType,
eventSystemFlags: EventSystemFlags,
targetInst: null | Fiber,
nativeEvent: AnyNativeEvent,
nativeEventTarget: EventTarget,
) {
const events = extractPluginEvents(
topLevelType,
eventSystemFlags,
targetInst,
nativeEvent,
nativeEventTarget,
Expand Down
1 change: 1 addition & 0 deletions packages/legacy-events/EventSystemFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export const RESPONDER_EVENT_SYSTEM = 1 << 1;
export const IS_PASSIVE = 1 << 2;
export const IS_ACTIVE = 1 << 3;
export const PASSIVE_NOT_SUPPORTED = 1 << 4;
export const IS_REPLAYED = 1 << 5;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

2 changes: 2 additions & 0 deletions packages/legacy-events/PluginModuleType.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import type {
ReactSyntheticEvent,
} from './ReactSyntheticEventType';
import type {TopLevelType} from './TopLevelEventTypes';
import type {EventSystemFlags} from 'legacy-events/EventSystemFlags';

export type EventTypes = {[key: string]: DispatchConfig};

Expand All @@ -24,6 +25,7 @@ export type PluginModule<NativeEvent> = {
eventTypes: EventTypes,
extractEvents: (
topLevelType: TopLevelType,
eventSystemFlags: EventSystemFlags,
targetInst: null | Fiber,
nativeTarget: NativeEvent,
nativeEventTarget: EventTarget,
Expand Down
1 change: 1 addition & 0 deletions packages/legacy-events/ResponderEventPlugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ const ResponderEventPlugin = {
*/
extractEvents: function(
topLevelType,
eventSystemFlags,
targetInst,
nativeEvent,
nativeEventTarget,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
'use strict';

const {HostComponent} = require('shared/ReactWorkTags');
const {PLUGIN_EVENT_SYSTEM} = require('legacy-events/EventSystemFlags');

let EventBatching;
let EventPluginUtils;
Expand Down Expand Up @@ -313,6 +314,7 @@ const run = function(config, hierarchyConfig, nativeEventConfig) {
// Trigger the event
const extractedEvents = ResponderEventPlugin.extractEvents(
nativeEventConfig.topLevelType,
PLUGIN_EVENT_SYSTEM,
nativeEventConfig.targetInst,
nativeEventConfig.nativeEvent,
nativeEventConfig.target,
Expand Down
Loading