As such there's no real need to bundle in another fetch-ponyfill for react-native consumers. cross-fetch can simply re-export the existing fetch function (and related types).
There also exists some timing issue where the browser ponyfill is stomping the global fetch function with falsehere. The repro I've seen is in a decent sized app, while running in an iOS simulator and react-native@57. If I run the app, then start react-native JS debugging, this causes global.fetch to get set to false and never unset.
react-native
has built-in fetch polyfills based onwhatwg-fetch
already (https://github.com/facebook/react-native/blob/master/Libraries/Core/setUpXHR.js#L23-L26 some variant of this has existed over the last ~4 years or so from github history).As such there's no real need to bundle in another fetch-ponyfill for react-native consumers.
cross-fetch
can simply re-export the existing fetch function (and related types).There also exists some timing issue where the browser ponyfill is stomping the global fetch function with
false
here. The repro I've seen is in a decent sized app, while running in an iOS simulator andreact-native@57
. If I run the app, then start react-native JS debugging, this causesglobal.fetch
to get set tofalse
and never unset.