mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
80f8b0d512
* Add part of the event responder system
41 lines
1.1 KiB
JavaScript
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.
|
|
}
|