diff --git a/src/utils/hub.js b/src/utils/hub.js index 4e2fd8002..229429e23 100644 --- a/src/utils/hub.js +++ b/src/utils/hub.js @@ -230,7 +230,7 @@ function parseHeaders(rawHeaders) { * @param {RequestInit} [options] * @returns {Promise} */ -export function fetchBinary(url, options = {}) { +function fetchBinaryImpl(url, options = {}) { return new Promise((resolve, reject) => { const request = new Request(url, options); const xhr = new XMLHttpRequest(); @@ -270,6 +270,8 @@ export function fetchBinary(url, options = {}) { }); } +export const fetchBinary = IS_REACT_NATIVE ? fetchBinaryImpl : fetch; + /** * Determines whether the given string is a valid URL. * @param {string|URL} string The string to test for validity as an URL.