mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-06-04 11:04:58 +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
|
* @noflow
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import '../../modules/injectResponderEventPlugin';
|
|
||||||
|
|
||||||
import AccessibilityUtil from '../../modules/AccessibilityUtil';
|
import AccessibilityUtil from '../../modules/AccessibilityUtil';
|
||||||
import createDOMProps from '../../modules/createDOMProps';
|
import createDOMProps from '../../modules/createDOMProps';
|
||||||
import normalizeNativeEvent from '../../modules/normalizeNativeEvent';
|
import normalizeNativeEvent from '../../modules/normalizeNativeEvent';
|
||||||
import React from 'react';
|
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'
|
* 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
|
// based on https://github.com/facebook/react/pull/4303/files
|
||||||
|
|
||||||
import normalizeNativeEvent from '../normalizeNativeEvent';
|
import normalizeNativeEvent from '../normalizeNativeEvent';
|
||||||
import ReactDOM from 'react-dom';
|
|
||||||
import ReactDOMUnstableNativeDependencies from 'react-dom/unstable-native-dependencies';
|
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 { ResponderEventPlugin, ResponderTouchHistoryStore } = ReactDOMUnstableNativeDependencies;
|
||||||
|
|
||||||
const topMouseDown = 'topMouseDown';
|
const topMouseDown = 'topMouseDown';
|
||||||
@@ -78,6 +76,4 @@ ResponderEventPlugin.extractEvents = (topLevelType, targetInst, nativeEvent, nat
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
EventPluginHub.injection.injectEventPluginsByName({
|
export default ResponderEventPlugin;
|
||||||
ResponderEventPlugin
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user