Files
react/packages/react-native-renderer/src/ReactFabricEventEmitter.js
T
Dominic Gannaway 80f8b0d512 Add part of the event responder system for experimental event API (#15179)
* Add part of the event responder system
2019-03-26 16:55:25 -07:00

41 lines
1.1 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow
*/
import type {Fiber} from 'react-reconciler/src/ReactFiber';
import {
getListener,
runExtractedPluginEventsInBatch,
} from 'events/EventPluginHub';
import {registrationNameModules} from 'events/EventPluginRegistry';
import {batchedUpdates} from 'events/ReactGenericBatching';
import type {AnyNativeEvent} from 'events/PluginModuleType';
import type {TopLevelType} from 'events/TopLevelEventTypes';
export {getListener, registrationNameModules as registrationNames};
export function dispatchEvent(
target: null | Object,
topLevelType: TopLevelType,
nativeEvent: AnyNativeEvent,
) {
const targetFiber = (target: null | Fiber);
batchedUpdates(function() {
runExtractedPluginEventsInBatch(
topLevelType,
targetFiber,
nativeEvent,
nativeEvent.target,
);
});
// React Native doesn't use ReactControlledComponent but if it did, here's
// where it would do it.
}