Revert deprecation warnings for custom event plugin injection (#12167)
Nicolas Gallagher committed
Feb 6, 2018 at 10:39 UTC
3d8f465d99ece19238ccb561cdb157d2d676dda4
4 files changed
+3
-55
packages/events/EventPluginRegistry.js
-22
@@ -15,13 +15,10 @@ import type {
15
} from './PluginModuleType';
16
17
import invariant from 'fbjs/lib/invariant';
18
-import lowPriorityWarning from 'shared/lowPriorityWarning';
18
19
type NamesToPlugins = {[key: PluginName]: PluginModule<AnyNativeEvent>};
20
type EventPluginOrder = null | Array<PluginName>;
21
23
-let shouldWarnOnInjection = false;
24
-
22
/**
23
* Injectable ordering of event plugins.
24
*/
@@ -32,10 +29,6 @@ let eventPluginOrder: EventPluginOrder = null;
29
*/
30
const namesToPlugins: NamesToPlugins = {};
31
35
-export function enableWarningOnInjection() {
36
- shouldWarnOnInjection = true;
37
-}
38
-
32
/**
33
* Recomputes the plugin list using the injected plugins and plugin ordering.
34
*
@@ -228,21 +221,6 @@ export function injectEventPluginOrder(
221
export function injectEventPluginsByName(
222
injectedNamesToPlugins: NamesToPlugins,
223
): void {
231
- if (__DEV__) {
232
- if (shouldWarnOnInjection) {
233
- const names = Object.keys(injectedNamesToPlugins).join(', ');
234
- lowPriorityWarning(
235
- false,
236
- 'Injecting custom event plugins (%s) is deprecated ' +
237
- 'and will not work in React 17+. Please update your code ' +
238
- 'to not depend on React internals. The stack trace for this ' +
239
- 'warning should reveal the library that is using them. ' +
240
- 'See https://github.com/facebook/react/issues/11689 for a discussion.',
241
- names,
242
- );
243
- }
244
- }
245
-
224
let isOrderingDirty = false;
225
for (const pluginName in injectedNamesToPlugins) {
226
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
packages/react-dom/src/__tests__/ReactDOM-test.js
-19
@@ -377,25 +377,6 @@ describe('ReactDOM', () => {
377
}
378
});
379
380
- // https://github.com/facebook/react/issues/11689
381
- it('should warn when attempting to inject an event plugin', () => {
382
- expect(() => {
383
- ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.EventPluginHub.injection.injectEventPluginsByName(
384
- {
385
- TapEventPlugin: {
386
- extractEvents() {},
387
- },
388
- },
389
- );
390
- }).toLowPriorityWarnDev(
391
- 'Injecting custom event plugins (TapEventPlugin) is deprecated ' +
392
- 'and will not work in React 17+. Please update your code ' +
393
- 'to not depend on React internals. The stack trace for this ' +
394
- 'warning should reveal the library that is using them. ' +
395
- 'See https://github.com/facebook/react/issues/11689 for a discussion.',
396
- );
397
- });
398
-
380
it('throws in DEV if jsdom is destroyed by the time setState() is called', () => {
381
class App extends React.Component {
382
state = {x: 1};
packages/react-dom/src/__tests__/TapEventPlugin-test.internal.js
+3
-7
@@ -86,13 +86,9 @@ describe('TapEventPlugin', () => {
86
87
idCallOrder = [];
88
tapMoveThreshold = TapEventPlugin.tapMoveThreshold;
89
- expect(() =>
90
- EventPluginHub.injection.injectEventPluginsByName({
91
- TapEventPlugin: TapEventPlugin,
92
- }),
93
- ).toLowPriorityWarnDev(
94
- 'Injecting custom event plugins (TapEventPlugin) is deprecated',
95
- );
89
+ EventPluginHub.injection.injectEventPluginsByName({
90
+ TapEventPlugin: TapEventPlugin,
91
+ });
92
});
93
94
/**
packages/react-dom/src/client/ReactDOM.js
-7
@@ -1300,13 +1300,6 @@ const ReactDOM: Object = {
1300
},
1301
};
1302
1303
-if (__DEV__) {
1304
- // Show deprecation warnings as we don't want to support injection forever.
1305
- // We do it now to let the internal injection happen without warnings.
1306
- // https://github.com/facebook/react/issues/11689
1307
- EventPluginRegistry.enableWarningOnInjection();
1308
-}
1309
-
1303
type RootOptions = {
1304
hydrate?: boolean,
1305
};