mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-26 07:49:18 +00:00
[fix] ResponderEventPlugin injection for tree-shaking bundler
Previously this depended on a side-effecting `import` statement which would be removed under tree-shaking.
This commit is contained in:
@@ -7,12 +7,18 @@
|
||||
* @noflow
|
||||
*/
|
||||
|
||||
import '../../modules/injectResponderEventPlugin';
|
||||
|
||||
import AccessibilityUtil from '../../modules/AccessibilityUtil';
|
||||
import createDOMProps from '../../modules/createDOMProps';
|
||||
import normalizeNativeEvent from '../../modules/normalizeNativeEvent';
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ResponderEventPlugin from '../../modules/ResponderEventPlugin';
|
||||
|
||||
const { EventPluginHub } = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
||||
|
||||
EventPluginHub.injection.injectEventPluginsByName({
|
||||
ResponderEventPlugin
|
||||
});
|
||||
|
||||
/**
|
||||
* Ensure event handlers receive an event of the expected shape. The 'button'
|
||||
|
||||
+1
-5
@@ -1,10 +1,8 @@
|
||||
// based on https://github.com/facebook/react/pull/4303/files
|
||||
|
||||
import normalizeNativeEvent from '../normalizeNativeEvent';
|
||||
import ReactDOM from 'react-dom';
|
||||
import ReactDOMUnstableNativeDependencies from 'react-dom/unstable-native-dependencies';
|
||||
|
||||
const { EventPluginHub } = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
||||
const { ResponderEventPlugin, ResponderTouchHistoryStore } = ReactDOMUnstableNativeDependencies;
|
||||
|
||||
const topMouseDown = 'topMouseDown';
|
||||
@@ -78,6 +76,4 @@ ResponderEventPlugin.extractEvents = (topLevelType, targetInst, nativeEvent, nat
|
||||
);
|
||||
};
|
||||
|
||||
EventPluginHub.injection.injectEventPluginsByName({
|
||||
ResponderEventPlugin
|
||||
});
|
||||
export default ResponderEventPlugin;
|
||||
Reference in New Issue
Block a user