From 8311766a7b4f64ced870e06c740839e8b6722617 Mon Sep 17 00:00:00 2001 From: Michael Shang Date: Mon, 23 Mar 2020 18:28:37 +1100 Subject: [PATCH] fixes crash for react native instrumenting fetch - check for global.document.createElement to be function before calling --- packages/utils/src/supports.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/utils/src/supports.ts b/packages/utils/src/supports.ts index 46a5c5901f5f..87a903fd6653 100644 --- a/packages/utils/src/supports.ts +++ b/packages/utils/src/supports.ts @@ -106,7 +106,7 @@ export function supportsNativeFetch(): boolean { // so create a "pure" iframe to see if that has native fetch let result = false; const doc = global.document; - if (doc) { + if (doc && typeof doc.createElement === 'function') { try { const sandbox = doc.createElement('iframe'); sandbox.hidden = true;