Revert deprecation warnings for custom event plugin injection (#12167)

This commit is contained in:
Nicolas Gallagher
2018-02-06 18:39:03 +00:00
committed by Dan Abramov
parent 578c82d6a0
commit 3d8f465d99
4 changed files with 3 additions and 55 deletions
-22
View File
@@ -15,13 +15,10 @@ import type {
} from './PluginModuleType';
import invariant from 'fbjs/lib/invariant';
import lowPriorityWarning from 'shared/lowPriorityWarning';
type NamesToPlugins = {[key: PluginName]: PluginModule<AnyNativeEvent>};
type EventPluginOrder = null | Array<PluginName>;
let shouldWarnOnInjection = false;
/**
* Injectable ordering of event plugins.
*/
@@ -32,10 +29,6 @@ let eventPluginOrder: EventPluginOrder = null;
*/
const namesToPlugins: NamesToPlugins = {};
export function enableWarningOnInjection() {
shouldWarnOnInjection = true;
}
/**
* Recomputes the plugin list using the injected plugins and plugin ordering.
*
@@ -228,21 +221,6 @@ export function injectEventPluginOrder(
export function injectEventPluginsByName(
injectedNamesToPlugins: NamesToPlugins,
): void {
if (__DEV__) {
if (shouldWarnOnInjection) {
const names = Object.keys(injectedNamesToPlugins).join(', ');
lowPriorityWarning(
false,
'Injecting custom event plugins (%s) is deprecated ' +
'and will not work in React 17+. Please update your code ' +
'to not depend on React internals. The stack trace for this ' +
'warning should reveal the library that is using them. ' +
'See https://github.com/facebook/react/issues/11689 for a discussion.',
names,
);
}
}
let isOrderingDirty = false;
for (const pluginName in injectedNamesToPlugins) {
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
-19
View File
@@ -377,25 +377,6 @@ describe('ReactDOM', () => {
}
});
// https://github.com/facebook/react/issues/11689
it('should warn when attempting to inject an event plugin', () => {
expect(() => {
ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.EventPluginHub.injection.injectEventPluginsByName(
{
TapEventPlugin: {
extractEvents() {},
},
},
);
}).toLowPriorityWarnDev(
'Injecting custom event plugins (TapEventPlugin) is deprecated ' +
'and will not work in React 17+. Please update your code ' +
'to not depend on React internals. The stack trace for this ' +
'warning should reveal the library that is using them. ' +
'See https://github.com/facebook/react/issues/11689 for a discussion.',
);
});
it('throws in DEV if jsdom is destroyed by the time setState() is called', () => {
class App extends React.Component {
state = {x: 1};
@@ -86,13 +86,9 @@ describe('TapEventPlugin', () => {
idCallOrder = [];
tapMoveThreshold = TapEventPlugin.tapMoveThreshold;
expect(() =>
EventPluginHub.injection.injectEventPluginsByName({
TapEventPlugin: TapEventPlugin,
}),
).toLowPriorityWarnDev(
'Injecting custom event plugins (TapEventPlugin) is deprecated',
);
EventPluginHub.injection.injectEventPluginsByName({
TapEventPlugin: TapEventPlugin,
});
});
/**
-7
View File
@@ -1300,13 +1300,6 @@ const ReactDOM: Object = {
},
};
if (__DEV__) {
// Show deprecation warnings as we don't want to support injection forever.
// We do it now to let the internal injection happen without warnings.
// https://github.com/facebook/react/issues/11689
EventPluginRegistry.enableWarningOnInjection();
}
type RootOptions = {
hydrate?: boolean,
};