77 * @flow
88 */
99
10- import { getListener } from 'events/EventPluginHub' ;
10+ import { getListener , runExtractedEventsInBatch } from 'events/EventPluginHub' ;
1111import { registrationNameModules } from 'events/EventPluginRegistry' ;
1212import { batchedUpdates } from 'events/ReactGenericBatching' ;
13- import { handleTopLevel } from 'events/ReactEventEmitterMixin' ;
1413import warning from 'fbjs/lib/warning' ;
1514
1615import { getInstanceFromNode } from './ReactNativeComponentTree' ;
1716import ReactNativeTagHandles from './ReactNativeTagHandles' ;
1817
19- export * from 'events/ReactEventEmitterMixin' ;
18+ import type { AnyNativeEvent } from 'events/PluginModuleType' ;
19+
2020export { getListener , registrationNameModules as registrationNames } ;
2121
2222/**
@@ -25,7 +25,7 @@ export {getListener, registrationNameModules as registrationNames};
2525 */
2626
2727// Shared default empty native event - conserve memory.
28- const EMPTY_NATIVE_EVENT = { } ;
28+ const EMPTY_NATIVE_EVENT = ( ( { } : any ) : AnyNativeEvent ) ;
2929
3030/**
3131 * Selects a subsequence of `Touch`es, without destroying `touches`.
@@ -90,12 +90,17 @@ const removeTouchesAtIndices = function(
9090export function _receiveRootNodeIDEvent (
9191 rootNodeID : number ,
9292 topLevelType : string ,
93- nativeEventParam : ?Object ,
93+ nativeEventParam : ?AnyNativeEvent ,
9494) {
9595 const nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT ;
9696 const inst = getInstanceFromNode ( rootNodeID ) ;
9797 batchedUpdates ( function ( ) {
98- handleTopLevel ( topLevelType , inst , nativeEvent , nativeEvent . target ) ;
98+ runExtractedEventsInBatch (
99+ topLevelType ,
100+ inst ,
101+ nativeEvent ,
102+ nativeEvent . target ,
103+ ) ;
99104 } ) ;
100105 // React Native doesn't use ReactControlledComponent but if it did, here's
101106 // where it would do it.
@@ -111,7 +116,7 @@ export function _receiveRootNodeIDEvent(
111116export function receiveEvent (
112117 rootNodeID : number ,
113118 topLevelType : string ,
114- nativeEventParam : Object ,
119+ nativeEventParam : AnyNativeEvent ,
115120) {
116121 _receiveRootNodeIDEvent ( rootNodeID , topLevelType , nativeEventParam ) ;
117122}
0 commit comments