1 | "use strict";
|
2 |
|
3 | var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
4 | Object.defineProperty(exports, "__esModule", {
|
5 | value: true
|
6 | });
|
7 | exports.default = void 0;
|
8 | var _react = _interopRequireDefault(require("react"));
|
9 | var unsafeLifecyclesPolyfill = function unsafeLifecyclesPolyfill(Component) {
|
10 | var prototype = Component.prototype;
|
11 | if (!prototype || !prototype.isReactComponent) {
|
12 | throw new Error('Can only polyfill class components');
|
13 | }
|
14 |
|
15 |
|
16 | if (typeof prototype.componentWillReceiveProps !== 'function') {
|
17 | return Component;
|
18 | }
|
19 |
|
20 |
|
21 |
|
22 | if (!_react.default.Profiler) {
|
23 | return Component;
|
24 | }
|
25 |
|
26 |
|
27 | prototype.UNSAFE_componentWillReceiveProps = prototype.componentWillReceiveProps;
|
28 | delete prototype.componentWillReceiveProps;
|
29 | return Component;
|
30 | };
|
31 | var _default = exports.default = unsafeLifecyclesPolyfill; |
\ | No newline at end of file |