Add a workaround for incomplete Proxy polyfill issue (#12017)
Dan Abramov committed
Jan 14, 2018 at 18:39 UTC
80d6792882e65951aac179d5cb976ad5621f4c4e
1 file changed
+5
-1
packages/events/SyntheticEvent.js
+5
-1
@@ -12,7 +12,6 @@ import invariant from 'fbjs/lib/invariant';
12
import warning from 'fbjs/lib/warning';
13
14
let didWarnForAddedNewProperty = false;
15
-const isProxySupported = typeof Proxy === 'function';
15
const EVENT_POOL_SIZE = 10;
16
17
const shouldBeReleasedProperties = [
@@ -234,6 +233,11 @@ SyntheticEvent.extend = function(Interface) {
233
* in which some Event properties are set to undefined (GH#10010)
234
*/
235
if (__DEV__) {
236
+ const isProxySupported =
237
+ typeof Proxy === 'function' &&
238
+ // https://github.com/facebook/react/issues/12011
239
+ !Object.isSealed(new Proxy({}, {}));
240
+
241
if (isProxySupported) {
242
/*eslint-disable no-func-assign */
243
SyntheticEvent = new Proxy(SyntheticEvent, {